On one hand, 401K money takes time....as in, you can only put so much in per year (barring the catch-up provisions) and then you need time to leverage the tax free gains, so not a good idea to raid it. But if stock market were to fall, get out while the getting is good, but would probably take a tax hit.
On the other hand, property has been hedge when markets fall. I mean, you gotta live some place, and rent is paying someone else's mortage, so why not pay yourself? Besides, what have housing prices done for the last 20 yrs, on average?
Then there are the intangibles that only you get discern for yourself.
In the end, the math will probably pen out something like 60% makes sense to keep house. Will only get more certain if you take fewer variables into account, and even then....
All above only my opinion, you pay your money, you take your chances.
PS
Forgot to say: I would try to keep the residence.