You potentially have several strong claims here. Let me walk you through them.
State Consumer Protection / Unfair and Deceptive Acts and Practices (UDAP): Every state has a consumer protection statute that prohibits deceptive trade practices. If the dealer knew or should have known about the prior accident damage and failed to disclose it, that's a textbook violation. Many states provide for treble damages and attorney's fees under these statutes, which makes it worthwhile for attorneys to take these cases.
Dealer Disclosure Requirements: Most states impose affirmative disclosure obligations on dealers for known material defects, especially structural or frame damage. The dealer's claim that they "relied on Carfax" is weak — dealers are generally held to a higher standard than consumers. A reasonable pre-sale inspection by a licensed dealer should have caught frame straightening and repainted panels.
FTC Used Car Rule (16 CFR Part 455): This federal rule requires dealers to display a Buyers Guide on every used car. If the dealer made specific representations about the car's condition or history that were false, the Buyers Guide itself becomes evidence. Also worth checking whether they misrepresented the car as "certified" or inspected.
I'd recommend getting your mechanic's findings in writing, pulling the actual title history from your state DMV (not just Carfax), and checking whether the VIN shows up on the NMVTIS database. Carfax misses a lot of accidents, especially those settled privately or repaired at independent shops. You can also explore whether the dealer has a pattern of this — check their reviews and any complaints filed with your state AG.
A demand letter is a strong first step here. You can find templates specific to automotive disputes at /Demand-Letters/Automotive/.