Risky Business, Say Anything and Clockwork Orange. All three contain canonical examples of characters interacting with practical music playback ("Old Time Rock and Roll," "In Your Eyes" and Beethoven's 9th, respectively). It's an awesome device for pulling the audience into the character's headspace.
But what, you ask, are good examples of this effect on television?
- Six Feet Under Series Finale: "Breathe Me" by Sia
It's a good thing this isn't actually a good song because I can't hear it without getting all weepy in remembrance of the best last episode ever.
- Lost Season S2E1: "Make Your Own Kinda Music" by Mama Cass
I'd basically given up on Lost midway through the first season. The introduction of the Hatch in this tantalizing obtuse way brought me back around.
- Star Trek: TNG S2E2: Gymnopedie #1 by Eric Satie
The Enterprise is going to be blowed up so an alien force can learn what death is like. Picard's response is to mope while waiting for a firey death with this as the soundtrack. How emo is that?
- Battlestar Galactica S2E2: Metamorphosis #1 by Philip Glass
Starbuck returns to Caprica and drops by her old pad. What will she pop in the hifi to unwind from being hunted by Cylons? Serialist piano music, of course.
- Buffy S2E1: "Sugar Water" by Cibo Matto
This one's kind of a cheat because rather than having the track played back, Cibo Matto performs it. And there's a dozen better examples from West Wing of the use of live musical performance. But none of those episodes have Sarah Michelle Gellar performing some sort of upright lap dance in a slinky dress.