Can a Mac's separate audio-in and audio-out ports be reversed in software? Recently my Mid 2009 15 Inch (2.66 GHz) MacBook Pro's audio-out headphone port has gotten physically "loose". When I plugin anything it easily slips out changing the audio output from "Headphones" to "Built-in speakers".  

My audio-in port has not been used very much, and the same mini-jack plugged in there sits tight. 

I might be wrong, but I always thought that the audio-in/out ports did not differ much from each other hardware wise, so I was wondering if it is somehow possible to configure my MacBook Pro (software wise) to reverse these ports.

If I could output audio through the audio-in port I would be happy. It would be ideal, but not a necessity and that the Mac would then accept audio through the headphone port.
Every Mac with two headphone sized jacks has one for in and one for out as the hardware is specialized for one direction. You don't need to repair the computer to remedy this if you are OK with an external DAC such as the Griffin iMic. 

The Mid 2009 MBP have identical physical connectors soldered on to the logic board, so even if the jack parts themselves are physically identical, they are wired to different parts of the sound in/out circuitry for both analog and digital and replacing that mounted part that would require a high level of soldering skill. The cheapest repair for this issue is the flat rate repair from Apple but even that is pricey when you could use tape or some other physical aid to keep the headphone in the jack as the metal latch no longer holds the pin properly.