You don't learn facts well. But you learn how to cope with extreme stress. Apparently the medical field values that. Some life-or-death surgeries are many hours long, so it makes some sense that this would be the case.
The general-practice doctors I know all have stories about them. They're not uncommon. Also, doctors have on-call rotations. People get shot, stabbed, in car accidents, etc at all hours. So odds are that even if you avoid the planned long surgeries, you'll still have a low-sleep surgery at some point.