Mine was like that within the first 6 months I had it. THe apple store said you have to swap out the whole motherboard (logic board for apple folks) to fix it.
Mine works if I put slight lateral tension on it, so I have my speaker cord taped to the side just a bit. Ghetto esp for a mac pro, but I haven't had time to take it in and lose access to my computer for the days/weeks that it would take. I plan on doing so over Christmas break.
Try pushing slightly to the side at hte jack where it inserts into the machine and see if that works. If so, just get some tape 🙂