There is nothing wrong with listening to music. It can be soothing and calming when it's the right type of music at the right time. But if it's becoming intrusive and interfering with your concentration, then simply listen to it less often and you will find other thoughts and interests will take its place.
Void meditation is an excellent method of dealing with unwanted thoughts:
Listen to the song. Or if you have the song memorized, then "listen" to it in your mind until the end. The song is still going because you didn't finish it.