First of all, it sounds like your company is abusing concept of deadlines and estimations - estimations are estimations and that is all they are. Nobody, ever should expect for a estimation to fit in a deadline exactly and deadline should have a very reasonable safety buffer over estimation for exactly these situations. Delivering sooner is okay, delivering past the deadline is not.
Amending to the previous answers, and based on my previous experience this might as well be a communication issue for one simple reason - people in management often lack technical skills and understanding, and simply put, they are underestimating the importance of software quality which is a real need in this case apparently, as you stated that a lot of refactoring will be needed. Based on that, you should probably present management with the fact that doing it later will cost more, as technical debt only increases and the problem that already exists will not simply go away if postponed - it will increase in severity as you add more and more complexity to the project, and that increase will be exponential to the point where maintaining the project will suck up huge amount of resources. I don't think a wise management will pass on this if it is absolutely certain they will loose money if this continues in a way that it does.
If this is a inside product, argument that we should actually produce something that works well instead of a half baked cake should pass with flying colors.
If this is a product for some external customer, even more - people usually are reasonable enough to accept extending deadlines if that means the end result will improve by order of magnitude.
Last, but not least, you should figure out why this gross underestimation happened in the first place and place a mechanism from preventing it from happening in the future - were the tech people not involved in estimations? Was something important excluded from the estimations, and if so, why? And if so, why was not the deadline extended after it was proven to be unrealistic?