Fifth seed Roger Federer was dumped out of the Shanghai Open, losing to Frenchman Gael Monfils 6-4, 6-7(5), 6-3 in the third round on Thursday.
After dropping the first set, the 17-time Grand Slam title winner was on the brink of going out in straight sets at 3-5 down in the second, and later 3-5 down in the tie-break before winning four straight points.
Monfils then broke the Swiss former world number one in the fourth game of the decider.
It was Monfils's second victory over Federer in eight meetings, and leaves the Swiss battling to reach the end-of-season ATP World Tour Finals for the 12th consecutive year.
Monfils will play either top seed and defending champion Novak Djokovic or Fabio Fognini in the quarter-finals.
Meanwhile, sixth seed Juan Martin del Potro became the first player to reach the quarter-finals after Tommy Haas withdrew injured.
German Haas, who beat compatriot Daniel Brands and American Sam Querrey to reach the third round, had been unable to play due to a back injury, according to media reports.
Argentine Del Potro has also had health problems during the tournament, battling fever during his second round match against German Philipp Kohlschreiber, which he rallied to win 3-6, 6-3, 7-6(4).
Frenchman Jo-Wilfried Tsonga also advanced to the next round by beating Japan's Kei Nishikori 7-6(5), 6-0.
Serb Novak Djokovic, who was replaced by Rafa Nadal as world number one on Monday, plays Italian Fabio Fognini while Roger Federer meets Frenchman Gael Monfils in their third-round encounters also on Thursday.
Image: Gael Monfils
Photograph: Lintao Zhang/Getty Images