I use to be able to listen to music on my Sprint HTC Hero through my earphones, then one day no longer did the music play through the earphones, the music went through the main speaker. So I tried a second set of earphones to see if it was the earphone problem. But, it still comes out the speaker.

the socket u plug the ear phones into is faulty, u need to get it repaired, or try blowing into it to clear any dust or crumbs that may be inside.
I think there’s something wrong with the ear phones you are using, I would try another set of ear phones.