The excruciating collapse by Osaka played out on one of the game's biggest stages.
The Japanese world No.81 was in tears several times, a distraught Osaka at one point hanging her head and covering her eyes as she walked to a corner of the court.
But there was no place to hide inside the massive Arthur Ashe Stadium from the gaze of thousands of fans or a ruthless Keys, who moved in for the kill and clinched the comeback when Osaka sent a return wide.
Osaka's meltdown was in many ways reminiscent of a distraught Martina Hingis collapse to Steffi Graf on centre court at Roland Garros in 1999 and Jana Novotna's tearful loss to Graf in the 1993 Wimbledon final when the Czech sobbed on the shoulder of the Duchess of Kent.
Meanwhile, Britain's Johanna Konta looked back to full fitness as she swept past Switzerland's Belinda Bencic 6-2 6-1 to reach the last 16.
A semi-finalist at the 2016 Australian Open, the Sydney-born 13th seed Konta never allowed Bencic into the match, hitting eight aces as she matched her best effort in the season's final grand slam at Flushing Meadows.
Wozniacki continued her resurgence with a commanding 6-3 6-1 win over Romania's Monica Niculescu.
The Dane, a US Open finalist in 2009 and 2014 but unseeded this year after being sidelined for two months by an ankle injury, dominated from the start and wrapped up victory in just under an hour-and-a-half.
Niculescu, ranked 16 places above Wozniacki in the rankings at 58th, made life tough early on, particularly with her sliced forehand which is a rarity on the WTA Tour.
And Angelique Kerber, enjoying a breakout season that has her challenging for the world No.1 ranking, crushed 17-year-old American qualifier CiCi Bellis 6-1 6-1 to reach the fourth round.
Next up for Kerber is Petra Kvitova of the Czech Republic, a 6-3 6-4 winner over 22nd seed Elina Svitolina of Ukraine. Kerber and Kvitova have split their eight career meetings.
- AAP