The third-seeded American broke three times compared to Stakhovsky converting only one of seven opportunities.
Querrey will play French wild card Edouard Roger-Vasselin, who rallied to defeat Ricardas Berankis of Lithuania 2-6, 6-4, 6-2.
Albert Montanes advanced to the last eight by beating Victor Hanescu 7-5, 7-6 (2), and Pablo Andujar thrashed Lu Yen-hsun 6-2, 6-0.
In other second-round matches, Robin Haase was leading fourth-seeded John Isner 6-4, 1-4 when play was suspended because of rain.
Results from the fourth day of the ATP Nice Open tennis tournament (x denotes seeding):
Second Round:
Albert Montanes (ESP) bt Victor Hanescu (ROM) 7-5, 7-6 (7/2)
Paul-Henri Mathieu (FRA) bt Carlos Berlocq (ARG) 7-5, 3-6, 6-3
Sam Querrey (USA x3) bt Sergiy Stakhovsky (UKR) 7-5, 6-3
Edouard Roger-Vasselin (FRA) bt Ricardas Berankis (LTU) 2-6, 6-4, 6-2
Pablo Andujar (ESP) bt Lu Yen-Hsun (TPE) 6-2, 6-0