To ease the psychological pain, I take comfort in reminding myself I can always get back in later, be it 5 minutes or 5 weeks from now. I can always get back in.
Strategically speaking, if the thesis is invalidated, get out. When things turn around in your favor with a new thesis, get back in...