This was the hardest lesson for me to learn. I succeed at solving problems by being stubborn, but stubbornness is the problem.
Get out. Get out fast and clean, if you can, fast, if you can't. Clean is secondary.
There is a whole world of projects that value competence. They deserve it far more than these bozos.