For movies and series, the site http://www.tunefind.com/ can be used.
For example, you can see that Journey’s Don't Stop Believin' was featured in S6E21 of The Sopranos, in several episodes of Glee, in S3E2 of Scrubs, and so on. It’s, of course, not complete (e.g., it misses that the song was also featured in the movie Monsters, which isn’t indexed yet), but that’s to be expected. Users can add new songs to movies/episodes and vote if they are correct.
Caveat 1: You can’t directly search for a musical work. You have to start from the directory of all artists (or use the search function), visit the artist’s page, and then make an on-page search for the title.
Caveat 2: They don’t curate the artist list very well. For example, the song When Things Explode (from UNKLE feat. Ian Astbury) is not listed on the page for "UNKLE" (and they don’t have a page for Ian Astbury), but on the page "UNKLE featuring Ian Astbury".
Caveat 3: The same title can appear several times on an artist’s page, e.g., when users entered it coming from different albums, or with the title written in different ways, or for no obvious reasons. For example, the song Sinnerman (from Nina Simone) is listed on her page under "Sinner Man (The Best of Nina Simone)", "Sinnerman (The Thomas Crown Affair (Music from the MGM Motion Picture))", and "Sinnerman (The Essential Nina Simone)". Another example: The song Intro (from The xx) is listed three times on their page, but in all three cases as "Intro (XX (Bonus Track Version))".