Try to focus your attention on something else. Listen to a different song, for example, or, if you don't have any music, hum a different song in your head. Of course, with this strategy you risk getting the new song stuck in your head. If you are near a computer, try using Pandora radio (Pandora.com). The excitement of discovering new music might make you forget that annoying old song.
Turn on the news or listen to a book on tape. Having to focus on new aural information will distract you from the song.
Try focusing on a specific task, like a crossword puzzle or a sudoku.
If you are lying in bed with none of the above solutions nearby, try reciting a poem or narrative to yourself. This can be a calming activity before falling asleep.