Marin Cilic defeated 19-year-old Australian Alex de Minaur 4-6, 3-6, 6-3, 6-4, 7-5 to reach the US Open last 16 on Sunday morning in the second ever latest finish at the tournament.
Cilic, the 2014 champion, needed eight match points to defeat the world number 45 in a four-hour tie which ended at 2.22 local time (0622GMT), just four minutes short of the record for the latest finish in New York.
Seventh seed Cilic will face Belgium's David Goffin for a place in the quarter-finals.
"Alex showed incredible fighting spirit, he played his heart out," said Cilic who had squandered a 5-2 lead in the final set.
De Minaur saved five match points in the eighth game, another in the ninth and a further one in the last game before Cilic finally delivered the killer blow.
"It was an insane match. I was ahead 5-2 and there was some amazing tennis," said the big Croatian after his sixth career comeback from two sets to love down.
"I was just a little luckier tonight.
"It's 2.30 in the morning but people stayed to watch. It was an incredible match and it doesn't get much better than this."
De Minaur, who started the season at 208 in the world, had his chances to cause a major shock.
As well as having been two sets to the good, he also carved out a break for 2-1 in the final set before Cilic's greater experience eventually told.