Many times vehicles are sold with known frame or other types of body damage. Dealers are required to disclose material facts to purchasers. Damaged vehicles are probably valued at 25-80% of the price you have paid and possibly nothing if the prior damages was severe. Safety concerns are aways an important issue, on top of the monetary losses.
These cases are more common than you think. There are actually special auctions that only sell damaged vehicles to dealers. Some are even owned by insurance companies. I have litigated many cases where Certified Used Cars have been sold in a damaged condition despite an extensive 100-point inspection.
The Law Office of Jonathan Rudnick is a law firm in Middletown/Red Bank NJ that litigates claims against car dealerships.