Q: Mid-2009 15" MBP Line-out / Headphone-out jack not working properly - how to resume behaviour without replacing Logic Bus? I'm in the unenviable position of having a pretty maxed out Mid-2009 15" MacBookPro (1TB SSD+8Gb memory), and I've been getting almost 6 years of continuously decent behaviour out of it... 

Except...

The line-out / headphone-plug jack has never been amazingly solid.

And in the last week or so, I've started experiencing behaviour where even if I plug in a cable, OS X or the hardware might not recognise that the cable is plugged in, so I will sometimes be stuck with laptop speaker output only.

Are there tricks that I could use / try out to make the plug "work better"?

Unfortunately, Apple just discontinued mid-2009 15" MBP Logic Bus manufacturing / sales - so I cannot dish out the 700Eur to get the Logic Bus replaced at repairs.
You will be amazed what can collect in the headset socket over the years, hindering its proper functioning. Giving them an occasional good cleaning will keep them running.

First, use a tooth pick and try to remove anything that could be stuck in there.

Next use a q-tip soaked with alcohol and swipe in there to clean the contacts.