North towards San Luis Potosí
There's only one way out towards San Luis Potosí, and that's 5 de febrero. Unfortunately, there really aren't any good spots to stand along the side and hitch. You can take a local bus (route 121) toward Juriquilla ($8.50). Ask the driver to let you off before it turns off 5 de febrero. At that point, you're pretty much out of town, so there's little local traffic, but the flow of traffic is a bit quick for thumbing. About 500m or so down the road is a gas station where you might have better luck.
South towards Mexico City
To get out of Querétaro, you can take a bus toward Pedro Ocevedo from the central de autobuses for 22 pesos, leaving every ten minutes. That takes you onto the freeway, and there are plenty of gas stations to get off at.
Nomadwiki & Trashwiki