It would be great if we had enough time to plan out everything before executing, but that's not always the case. While it's not a good idea if you procrastinate and do everything last minute, it's entirely possible that you encounter this situation because of factors that are out of your control.
Calm down, think rationally and act fast. That's what you should do.