As an undergraduate I had almost finished an essay (night before)and at about 2am my computer (a second hand laptop) crashed. It had to be totally reformated. So about 3am I started again...
I handed it in on time and got a decent grade, but it would never work that way with PhD work.