World number one Ashleigh Barty fell in the US Open third round after Shelby Rogers produced a superb comeback in front of a raucous New York crowd.
Wimbledon champion Barty held a 5-2 lead in the final set and twice served for the match but home favourite Rogers battled her way back into contention.
The world number 43 then came through the resulting tie-break to stun the top seed 6-2 1-6 7-6 (7-5).
She will face British teenager Emma Raducanu next.
Barty was devoid of rhythm in the first set but seemed to have found, if not her best form, enough to take her into the fourth round.
However, Rogers, helped by the crowd, pulled off a remarkable show of shot-making to beat Barty for the first time in six attempts.
It is just Barty's eighth loss of what has been a sterling season.
"You guys are in control of the tournament," Rogers told the crowd.
"You were awesome and I didn't want to leave. I just wanted to make balls and stay in the match."
Barty had done all the hard work, overcoming a sluggish start to take control of the match, but her form once again deserted her as she served for a place in the last 16.
Despite having the double break cushion, Barty looked tight as she first served for the match, and a netted forehand that handed Rogers the break prompted a loud "come on" from her opponent and the crowd.
Rogers gestured for the crowd to make more noise and they responded, helped by her fending off Barty in her own service game from 30-30, and the American quickly creating another break-point opportunity in the next.
A trademark forehand from Barty kept her in the game but Rogers, out of nowhere, lifted her level, and she was roared on by the crowd as she clawed her way to 5-5.
The tie-break was a nervy affair at first, both players missing routine shots as they tried to end the points quickly, but it was Barty who blinked first.
The two players shared a warm word and hug at the net before a tearful Rogers soaked in the atmosphere and cheers from the crowd.
Barty is a pragmatic character but she will know that she had this match on her racquet.
"It's never nice when you have a couple of opportunities to serve out a match and can't get it done," Barty said. "Six in the third is brutal. It's a tough one to swallow.
"I found a way to really turn it in my favour and just wasn't able to just quite finish off. It's disappointing, but we'll move on."
Barty too had warm support from the crowd as she recovered from a poor start that saw her serve four double faults to go an early break down in the opening set.
The Australian could not find her radar, her forehand in particular looking off, and she finished the first set with 17 unforced errors, compared to just seven winners.
Although she forced herself back into some form, Rogers' resilience - and the Arthur Ashe crowd - proved a step too far for Barty.
"[It's] not a match I'll dwell on for too long in the sense that there are so many 'what ifs'. Millimetres could have changed things," Barty said.
"You accept that in tennis. I just didn't quite have enough, physically or mentally, in the tank. But that's OK. I'll sleep well tonight knowing I gave everything I could. It just wasn't quite enough.
"I feel like the Slams, you're kind of building up to it and afterwards there's a reset. We reset now. We go back to the drawing board, work out what we want to do for the rest of the season."
Meanwhile Novak Djokovic had to come from behind to beat Kei Nishikori and keep his bid for a calendar Grand Slam alive as he advanced to the US Open fourth round.
The world number one overcame a loose first set to win 6-7 (4-7) 6-3 6-3 6-2 and beat the Japanese for the 17th time in a row.
The Serb, 34, is aiming for a men's record 21st Grand Slam title.
He will face American Jenson Brooksby next, after the wildcard beat Russian 21st seed Aslan Karatsev in five sets.
Brooksby, the world number 99, came from behind to win 6-2 3-6 2-6 6-3 6-3 and become the youngest man from the USA to reach the US Open fourth round since Andy Roddick in 2002.
Top seed Djokovic has received a mixed reception from the New York crowd but appeared to have won them over by the final point.
He asked them to give him more noise several times, cupping his ear toward the fans, and did not do his traditional 'show of love' celebration to the stands.
He did, however, spend some time after his post-match interview signing autographs and giving several young fans items from his kit bag.
Elsewhere South African tennis star, Lloyd Harris, is through to the round of 16 at a major for the first time after upsetting Canadian 7th seed Denis Shapovalov, 6-4, 6-4, 6-4, on Saturday night at the US Open.
It marked the South African's second win over Shapovalov in 2021, having topped the Canadian in the Dubai semis in March.
"The fourth round is obviously a major accomplishment for me, it's my first one ever, and I'm looking forward to the next one. I can't wait to be back. Everything has been coming together this season. I feel confident in my game, and I want to keep the momentum going," Harris told the ATP Tour.
The South African broke serve five times and hit 26 winners to oust the Canadian world No. 10 in two hours and 11 minutes.
Harris had rallied from a two-sets-to-one deficit in the opening round against Olympic silver medalist Karen Khachanov of Russia, before dispatching American Ernesto Escobedo in straight sets to set up his encounter with Shapovalov.
The 24-year-old will next face American Reilly Opelka in search of a place in the quarterfinals.