Sam Querrey of the United States recovered from a humiliating first set to beat second-seeded Novak Djokovic 0-6, 7-6 (5), 6-4 in the second round of the Paris Masters on Wednesday.
It was the first time since the Miami Masters in March, 2010, that Djokovic has been eliminated so early in a tournament.
Djokovic, who will return to the world number one ranking this week, lived up to his reputation as a joker by entering the court wearing a Darth Vader mask on Halloween. He continued to put on a show by winning the first set in just 21 minutes.
But Djokovic then started to waver under the relentless accuracy of Querrey's serve, and made too many unforced errors the rest of the way.
Querrey hit 18 aces and converted his second match point when Djokovic's return sailed long.
Djokovic had already secured the year-end No. 1 ranking after defending champion Roger Federer pulled out.
After sealing the first set with some extravagant shot-making, everything had pointed to a comfortable win for Djokovic after he broke for a 2-0 lead in the second set. But Querrey found his range, hitting 10 aces during the set.
Djokovic played too many loose shots in the tiebreak and Querrey leveled the match on his first set-point when Djokovic's forehand clipped the net and bounced wide.
The match turned in Querrey's favour in the fifth game of the deciding set, when he broke for a 3-2 lead with a stinging forehand winner, and held for 4-2 after another sloppy forehand from Djokovic landed in the net.
Djokovic battled back and had a great chance to level at 4-4, but Querrey saved five break points in the eighth game, three of them aces.
Querrey will play either 14th-seeded Milos Raonic of Canada or Frenchman Jeremy Chardy in the third round.
Earlier, fourth-seeded David Ferrer beat Marcel Granollers 6-1, 6-3 in an all-Spanish match.
Ferrer, who is tied with Roger Federer for the most tour titles this year with six tournament wins, converted five of his six break points while dropping his serve only once.
He faces 16th-seeded Stanislas Wawrinka of Switzerland in the third round. Eighth-seeded Janko Tipsarevic of Serbia also advanced to the third round, beating Dutchman Igor Sijsling 6-4, 7-6 (0), and keeping alive his slim chances of qualifying for the season-ending ATP World Tour Finals in London.
Ninth-seeded Juan Monaco of Argentina beat Bulgarian Grigor Dimitrov 7-6 (4), 6-2 and still has an outside chance of reaching London. Tipsarevic and Monaco play each other next, but No. 12 Richard Gasquet's chances of reaching London have gone after a 7-6 (5), 4-6, 6-1 loss to South African Kevin Anderson.
Gasquet hit a forehand winner to break Anderson in the ninth game of the second set for a 5-4 lead and held to level the match.
But the Frenchman fell apart in the decider, losing his serve twice and failing to pressure Anderson, who won 92 percent of the points on his first serve. Anderson plays No. 5 Tomas Berdych of the Czech Republic, the 2005 champion, in the third round.