Novak Djokovic of Serbia (Photo: Reuters)
Serbia's Djokovic, who will replace Swiss Roger Federer as the world number one next Monday, breezed through the opening set before losing control.
Querrey was trailing 0-2 in the second set but dramatically improved after bagging his first game of the match.
Djokovic, who had got into the Halloween spirit by turning up on centre court wearing a Darth Vader mask, ended up being slayed by Querrey's powerful serve and forehand.
"Great tennis at the start but I knew that the main problem today will be the continuity of my energy," Djokovic, who had a stomach bug last weekend, told a news conference.
"Unfortunately, it wasn't to be after the second set. And during the second set I already felt that physically I'm down and I struggled every game."
Serbian press reported this week that Djokovic had considered pulling out of the Bercy tournament as his father Srdjan is in hospital with respiratory problems but the second seed refused to blame his personal problems for the loss.
"I'd rather not talk about it. Sorry about that, but it's just private and I'd like to keep it that way," he said.
"Some things happened and a lot of things are on my mind..., so right now I just need a couple of days' rest before (next week's season-ending ATP World Tour Finals in) London.
A red-faced Querrey was at first just looking to salvage his pride. He ended up pulling off a great escape.
"It's my biggest, this win feels great," Querrey told a courtside interviewer.
"I served great. When I was down 6-0 2-0 I just wanted to get a game and when I won that game I got a bit more confidence."
The American took an early break in the decider and saved five break points in the ninth game, wrapping an unlikely win on his second match point with a service winner.
He will next face Canadian 14th seed Milos Raonic or France's Jeremy Chardy.
Earlier France's Richard Gasquet lost his chance to qualify for the World Tour Finals when he slumped to a 7-6 4-6 6-1 defeat against the towering Kevin Anderson of South Africa.
Serbian Janko Tipsarevic was still on course for one of the two remaining spots in the eight-man season finale after the eighth seed beat Dutchman Igor Sijsling 6-4 7-6.
Later on Wednesday, British third seed Andy Murray will take on French wildcard Paul-Henri Mathieu.