Querrey's victory boosted the hosts after world number one Novak Djokovic earlier raced past John Isner 7-6 6-2 7-5.
Querrey, who just took over the top American ranking last month, looked tired and without confidence after Troicki won the second and third sets.
But with the charged-up crowd screaming in his ears, Querrey revived and powered through the fourth set before a tooth and nail battle for the fifth.
Querrey fought off two break points in the fourth game of the deciding set, and then broke the Serbian to 5-4 with a big forehand return that Troicki couldn't lift over the net.
The American then served out the match to love, ending it with a forehand winner on the run and a big serve.
"I'm a pretty mellow player generally and the crowd was awesome today," Querrey said.
"Winning that fourth set, they're on their feet and cheering. Then that fifth set, every game on my serve, on Troicki's serve, when it was a 30-all or deuce, they were loud and vocal, and it helped a lot."
Djokovic started off slowly against Isner and was broken in the third game when he double faulted twice, but the tall American handed the break back in the sixth game when he committed three straight unforced errors.
The two went into a tiebreaker where the big serving Isner usually flourishes, but he committed a key forehand error when serving and went down 2-0.
Djokovic successfully rode the lead to take the tiebreaker 7-5 when he deceived the American with an off-speed serve.
Djokovic played more aggressively after that and flew about the court, decisively winning the last 12 points of the match.
"These kind of matches are very intense and there is a lot at stake," said Djokovic, who finished the match with 24 winners and 10 unforced errors.
"You're playing for your country. You get more involved with the emotions and you really want to start well; you want to bring the first point to Serbia."
Djokovic was not originally scheduled to play doubles on Saturday, but he said he had left open the possibility of teaming with Nenad Zimonjic against the world's top team of Bob and Mike Bryan.
Serbian captain Bogdan Obradovic said he was yet to make a decision on the combination, however.
Holders Czech Republic overcame the absence of their top two players, Tomas Berdych and Radek Stepanek, to take a 2-0 lead against Kazakhstan in their Davis Cup quarter-final.
Jan Hajek had little trouble disposing 156th-ranked Mikhail Kukushkin 6-3 6-2 6-4 in the opening singles before Lukas Rosol prevailed over world number 205 Andrey Golubev 4-6 6-4 6-2 7-6 to put the defending champions in command after the first day.
"It's not that easy to play the first match so I had to keep my focus and followed my plan for most of the match and it paid off in the end," 94th-ranked Hajek said.
World number six Berdych was forced to pull out of the three-day indoor tie, played on clay at the National Tennis Centre in Astana, after injuring his shoulder at last week's Sony Open in Maimi, while 45th-ranked Stepanek was rested for the singles matches.
Stepanek, who has not played since undergoing neck surgery in January to relieve stress on a nerve, will have the chance to seal victory for the Czechs when he makes his competitive comeback in Saturday's doubles rubber.
"Radek wants to play tomorrow to finish our tie so I hope that they can finish it," Czech Republic captain Jaroslav Navratil said.
Berdych and Stepanek led the Czechs to their first Davis Cup title as an independent nation last year.
Kazakhstan, with all four of their players coming from Russia, shocked the Czechs 3-2 in their only previous Davis Cup tie in Ostrava in 2011 when they made their debut in the World Group as an independent nation but must produce a miracle to stage another upset this time round.
Juan Monaco beat Gilles Simon 7-6 6-2 6-4 in a duel of world top-20 players to put Argentina level 1-1 with France in their Davis Cup quarter-final.
The favourites took the first point when Jo-Wilfried Tsonga overcame Carlos Berlocq 4-6 6-2 6-3 5-7 6-2 after a slow start during which the Frenchman was broken in the opening game.
Visiting captain Arnaud Clement chose 13th-ranked Simon over Richard Gasquet in a calculated gamble for the second singles because the world number nine was suffering from fatigue and a nagging ankle problem.
Monaco, ranked 19th in the world, had not made a good start to the season but home advantage paid off on Friday as he was lifted by the passionate and noisy home crowd at Parque Roca.
He is from the Buenos Aires provincial capital La Plata where 50 people died in floods this week.
"We expected two very tight matches," Clement said before looking ahead to Saturday's doubles between Julien Benneteau and Michael Llodra, and Argentine pair David Nalbandian and Horacio Zeballos.
Argentine captain Martin Jaite said: "What was positive for me and makes me very proud was the performance of both my players. We have taken one point, we need two more."
Tsonga, who took nearly four hours to defeat Berlocq, said: "We knew it would be complicated. The crowd shout a lot between the first and second serves.
"I decided not to say anything (to the umpire). Each time they made a noise I had time to get more concentrated."
Berlocq, a 30-year-old journeyman who has spent most of his career in challenger tournaments, is enjoying belated recognition in the Davis Cup thanks in part to Juan Martin del Potro's decision to concentrate on his tour career.
"I was close to the best victory of my career but I didn't get it," said Berlocq.
Milos Raonic, riding his booming serve, helped Canada level their Davis Cup quarter-final with Italy.
Raonic cracked 25 aces to defeat Fabio Fognini 6-4 7-6 7-5 to square the tie at 1-1 after the opening day singles.
Italy took the lead when Andreas Seppi staged a mighty comeback to win the opening rubber against lowly-ranked Vasek Pospisal.
The Canadian, ranked 140th in the world, 118 places behind Seppi, threatened an upset when he won the first two sets.
But the more experienced Seppi wore him down to seal victory 5-7 4-6 6-4 6-3 6-3 to give the visitors the early lead.
- Sports & Recreation
- Novak Djokovic
- John Isner