I own a couple of planes and maintain our company's helicopter. I *think* I have a pretty good idea of the math that goes into these things.
If you are a licensed A&P who can do the wrenching yourself, owning can make financial sense. At 50 hours per year (more than the national average for owners) you can save about $3000 over the cost of rental on a 172 (comparing my actual expenses against our local FBO rental price). But the minute a repair comes up, you are F'd. You'll drop that $3k and more in a heartbeat if there is any repair that is more than a minor fix.
There is some other very good advice in this thread. IE: Do NOT touch your retirement money, and Buy right.
The Buy Right part means that you should have a professional PPO done by an impartial mechanic (never use the seller's mechanic). Research the plane. Check the internet for photos (owners love to post photos) and compare those photos to what you are buying - see what has changed and ask why. Check the NTSB database. Check the logbooks carefully, then have somebody else check them too. A missed AD can set you back thousands of dollars. Order the FAA report on the aircraft and compare the records that they have to what the seller presents. Etc.
I just sold an IFR equipped 172 about 6 months ago for $35,000. It needed nothing when I sold it and the new owner flew to my place in January to buy me lunch because he was still happy with his purchase. Make sure that you are one of those customers who can be that happy once the money is spent.
Experimental airplanes are another consideration. Sure, you can wrench on them yourself and save some money if you know what you are doing. IMO, experimentals require an even higher level of inspection prior to purchase to be sure you are not buying somebody's half-assed,
home depot death trap.
(FWIW, I sold one of my Porsches to pay off my biplane, which is experimental.)