The 20-time Grand Slam champion double-faulted 10 times, failed to convert a trio of set points and lost 3-6, 7-5, 7-6 (7), 7-6 (3) in the fourth round.
But Millman knows there's no friends on court when playing for a US Open quarter-final berth.
Keys started the match by holding in the first game and then doubled her lead after a 14-minute game that featured four game points for Cibulkova, who was baking on the sunny side of the court, and five break points for the American.
And at a set and 5-4 up with two set points on his own serve, it seemed this would simply be a case of Federer grinding out a relatively straightforward victory.
Djokovic fulfilled his role in setting up the mouthwatering last eight clash by beating Joao Sousa 6-3 6-4 6-3.
The biggest concern for Djokovic might well have been the conditions as the heat returned to NY after a few days of relief.
Up 2-1 in the third, Djokovic took an off-court medical timeout, leaving fans to wonder if the veteran might be suffering from a serious ailment.
Had the 20-time Grand Slam champion's serve not improved, he might have lost the third set before the tie-break.
"I'm very happy to get this done in straight sets".
As the temperatures rose so did the tempers, with both players engaging in animated arguments with chair umpire James Keothavong. Djokovic, however, was able to keep is cool just long enough to finish off Sousa with another late break.
7-6 (7/3) victory in his first Grand Slam fourth round match scuppered a blockbuster quarter-final between Federer and two-time victor Novak Djokovic.
Also into the quarterfinals: 2017 runner-up Madison Keys, who overwhelmed No. 29 Dominika Cibulkova 6-1, 6-3 thanks to a 25-7 edge in winners.
The 14th-seeded American, looking to go one better than her runner-up finish at Flushing Meadows past year, relied on both her unsafe serve and powerful groundstrokes to deny Cibulkova any chance of an upset win.
The 14th-seeded Keys will play the victor of the Carla Suarez Navarro vs. Maria Sharapova match in the night session at Arthur Ashe Stadium. It was clear the 37-year-old Federer was not at his best.
Sousa, who totaled 21 winners to 28 unforced errors, has never taken a set off Djokovic in five career head-to-heads.