The question is, "When do you use 'when' versus 'where,' as in, 'Remember that time we went on that ride when Joey barfed?' and 'There was that time where I threw the towel'?"
With examples from Supernatural and Saiyuki.
To figure out whether we want to use when or where, we first have to figure out what these words are describing. In each of these instances - Joey barfing on a ride and someone throwing a towel - the clause beginning with when or where is giving further information to help us understand exactly which specific incident, probably one out of many, is being referred to.
In the first instance, Remember that time we went on that ride when Joey barfed?, the clause starting with when is referring to that time. So when Joey barfed is describing the particular occasion (maybe last summer, maybe two summers ago, maybe June 5th of this year) we all went on a ride together and poor Joey tossed his cookies.
And that's exactly right - whenever we're talking about time, an occasion, or a circumstance, when is the word we want to use in crafting our description to identify that specific incident or timeframe:
"Do you remember the last time we hung out before you ended up being in charge, Cas?" asked Dean. "You know, three months ago, when you weren't walking around with Cthulhu and his tentacled buddies inside your gut?"
"I remember, Dean," said Castiel. "That was when I discovered that I needed help I couldn't find through regular channels."
In this example, both Dean and Castiel are talking about the same occasion: hanging out three months prior to this conversation. Therefore, when is definitely the word we want to use.
Where follows the same principle, but instead of referring to an occasion or circumstance, it should (technically) refer to a place, position, or location. So in the original example, There was that time where I threw the towel, the descriptive clause of where I threw the towel should actually be when I threw the towel because I'm talking about an occasion, not a place.
Gojyo frowned at the strange little statue. "Haven't we seen something like this before?"
"Yes, I believe we have," said Hakkai. He smiled. "About fifty miles back, in that town where you forgot your last pack of Hi-Lites."
Because he's talking about a specific town, which is a place, Hakkai uses where. Hakkai also uses where because he's a former schoolteacher who uses formal, proper grammar at all times. Someone like Gojyo or Goku, though, who have had less education and who speak in a much more relaxed, informal manner, would be likely to use where instead of when, just like in the original question:
"Stupid, bottomless monkey," Gojyo snapped. "You never leave any spring rolls for the rest of us, not even after that time where you knocked me an' Sanzo over a cliff and swore you'd do anything to make up for it!"
Although Gojyo is referring to a particular occasion, he's using where because he's annoyed and speaking informally.
So remember - if you want to be more formal, when should only refer to a specific time, occasion, or circumstance. Where, unless you or your characters are being relaxed in your dialogue, is for places, positions, or locations.
Sources:
Garner's Modern American Usage, 3rd Edition by Bryan A. Garner
"When" at Dictionary.com
"Where" at Dictionary.com