City on the Edge of Forever (South Park)

"City on the Edge of Forever" (also known as "Flashbacks") is the seventh episode of the second season of the American animated television series "South Park". The 20th episode of the series overall, it originally aired on Comedy Central in the United States on June 17, 1998. Series co-creator Trey Parker wrote the episode with writer Nancy M. Pimental. Parker also directed the episode. It guest stars Henry Winkler, Jay Leno, and Brent Musburger. In the episode, the boys reminisce about past experiences as their school bus is left hanging on the edge of a cliff. Ms. Crabtree leaves to look for help, but she forgets about the children when she meets a truck driver named Marcus.
Plot.
Eric Cartman, Stan Marsh, Kyle Broflovski, and Kenny McCormick get on the bus after the school bell rings. While they are riding the bus, it comes to a dead stop. At first, Cartman thinks the bus is out of gasoline, but he then realizes Ms. Crabtree has stopped the bus. Stan and Kyle both look out the window. They see that the bus is on the edge of a cliff. All the kids on the bus begin running around in fear, and the bus moves every time they move around. Ms. Crabtree urges the kids to stay calm; she gets out of the bus to go get help.
In the time she is gone, the kids begin playing with each other, until Stan tries to get everyone to calm down or else the bus will begin to tip over and fall off the cliff. The edge of the bus (which was keeping the bus from falling off the edge) is soon scraped off, and the bus tips over, but not so much that it falls down the cliff. 
While walking back to school to get help from the principal, Ms. Crabtree meets a truck driver named Marcus. Marcus helps her have a career as a stand-up comedian, but she leaves when she remembers she must save the kids on the bus. 
The bus falls off the cliff into a tub of ice cream, and Cartman wakes up in bed. He realize he was dreaming the whole time. Then Stan wakes up in bed, and he realizes he was dreaming about Cartman having a dream. The last scene shows Ms. Crabtree and Marcus. Ms. Crabtree knows it is all a child's dream but wants to enjoy it while she can.
Cultural references.
Many parts of this episode, including the title and one time when a kid in a red shirt leaves the bus, only to be eaten by monsters, are references to "Star Trek"'s original 1960s show.