I bought a 2000 TJ that hit and then ran over the hood of a Toyota. Insurance company totaled it. I got it for 7k in 2005. I replaced every damaged part with OEM stuff from the dealer. Repainted the hood and bought a new soft top, again from the dealer. The rifght front frame horn was bent and that is the major reason it was totaled. I straighten it with simple hydraulic jacks against beams in my garage. All measurements said the frame was straight.
Several months later I was going to Moab with Stinger. My neighbor ( who had watched my entire rebuil) looked envious. So I said come with us and drive the 2000. Before we got home his wife said buy it. I made twice what I paid for it. Even after paying for the parts and several new tools I made a nice profit. The neighbor still has it and won't sell it back to me!
My moral? Buy what you know you can fix.
Good luck.