The 21-year-old American had lost both previous meetings with the 6-foot-10 Karlovic, who won the only U.S. men's tournament played on clay in 2007 at a different Houston venue.
In this one, Sock broke the Croatian's huge serve twice in the first set and wound up spending less than an hour on the court.
"Right now I'll take one pretty much however I can get it," said Querrey, whose ranking has plunged from a high of 17 in 2011 to its current 82.
He hasn't advanced into the third round this season since the Australian Open in January.
"It's the first time I've been able to grind through a tough match like that all year," he said. "Hopefully it will lead to more wins and better results."
German-born Dustin Brown easily moved on, beating American Rhyne Williams 6-1, 6-2. Williams had reached the tournament's semifinals last year. The 29-year-old Brown, who began his pro career playing out of Jamaica, is ranked 101st.
Alejandro Gonzalez of Colombia rallied to eliminate Marcos Baghdatis of Cypress 4-6, 6-2, 6-1 in the final match of the night. Baghdatis, the Australian Open runner-up in 2006 who once ranked eighth, had been given a wild card by tournament organizers. His ranking has fallen to 129.