When he put a regulation volley into the net, a downcast Dimitrov got down on his haunches and stared at the ball in bewilderment.
Kozlov was cramping badly throughout the match and midway during the second set, he collapsed onto the court, waving for assistance as both his quads bulged from the excruciating cramps.
Dimitrov came to his aid and helped the American stretch the cramps out. Kozlov could barely move but he somehow carried on, rallying to win the third set and claim the three hour and 21 minute marathon 7-6 5-7 6-3.
Kozlov still had enough energy for a laugh though, sending a cheeky message to Rafael Nadal after he had to abandon their practice session when he was told he had been entered in the tournament.
"Rafa sorry for stopping practice today," Kozlov wrote on the TV camera along with a smiley face, as has become customary for tennis players after a victory.
Tennis pundits were shocked Kozlov had pulled off the upset over Dimitrov.
Commentator Jose Morgado tweeted: "Incredible. LL Stefan Kozlov, one of the most intriguing players on the ATP, gets the biggest win of his career."
Tennis reporter Ben Rothenberg dubbed it "the craziest match of 2022".
The chaos didn't stop there. At 1.30am local time, the last match of the day was delayed by an ill-timed ceremony that involved a giant Mexican flag being unfurled across the court.
The last match between Alexander Zverev and American young gun Jenson Brooksby was another classic three-setter that went well over three hours.
By the time world No. 3 Zverev finally sealed the 3-6 7-6 6-2 win, the time in Mexico was 4.55am.
It broke the record for the latest ever finish to an ATP tennis match, surpassing the classic battle between Lleyton Hewitt and Marcos Baghdatis at the 2008 Australian Open, which wrapped up at 4.34am in Melbourne.
The hot conditions may be oppressive in Mexico but perhaps the matches in future night session will be scheduled earlier, so at least everyone can get some sleep.