Hello and welcome. I am a licensed attorney and happy to assist.
I'll start by saying what it sounds like you already know, which is that you are clearly in the right and have legal options.
It is unclear how the Dodge dealership was able to ascertain the car had been in a wreck (twice) without a Carfax report reflecting this. if you subsequently ran the Carfax report and found information concerning one or the both accidents, you would have a clear-cut cause of action against the dealership that sold you the car for recission of the sale and for fraud. Even though the dealership claims they were in possession of a clear Carfax report at the time of the sale, it would be interesting to check, yourself. If something shows up, the dealer would not only have to refund your money and pay any foreseeable damages, but could be liable to you for treble damages for their fraud. Also, the dealership would still be responsible, even in the face of a clean Carfax report, if the damage to the vehicle was such that they should have known from their initial, general inspection. It sounds as though a reasonable dealership inspection would've turned up the defects since the second dealership was able to figure it out. An even stronger case against the dealership can be made if that "touch up paint" was really an attempt to cover up more serious damage.
If the Carfax report was really clean, and the accidents could not have been discovered by reasonable dealership inspection, then the person or entity is responsible for reporting the accident that did not do so are the ones on the hook.
If you do not get the resolution you seek from the dealership, you can take the next step and sue in court for your damages. The results of your own Carfax report will determine which entities you will want to name in the complaint. A good rule of thumb is to be over inclusive, rather than under inclusive. That way, if you cannot determine which entity is specifically at fault, or if there may have been liability by both, the court will make that determination and allocate liability accordingly. In any event, you are entitled to rescind the contract, get your money back, and may be entitled to damages for fraud in triple the amount otherwise awardable, and it does sound like that's the case.
I hope this information helps. If you need additional information or clarification, just let me know and I'll continue to provide assistance.