Tehran is the capital of Iran.
Take the BRT line 1 to Tehran Pars (Bus Rapid Transport, the faster buses with own bus lane in the city) this is the last stop and will bring you quite far in the east of tehran. After getting off the bus go straight until a big road goes right onto the highway. Get on the side of the highway and start hitching.
West towards Qazvin
Take the metro to Gholshahr (last station of Green Line). Take the Southern exit, turn right and walk about 15 minutes until you reach the highway to Qazvin. Jump over the small wall and walk another 15 minutes along the freeway until you reach the Police checkpoint.
Note : at this point you are well out of Tehran, in Karaj. It takes around 2 hours to reach this spot from downtown Tehran, but it costs only a metro ticket (300 tomans in May 2012, 0.20$) and the spot is great, because many trucks stop here a few minutes to show their documents to the Police, including a bunch of Turkish drivers who may give you a lift directly to the border.
Take the metro to Haram-e-Motahhar (Red Line). Walk West around Imam Khomeini tomb, and South along the Freeway. After 15 minutes, you'll see the pay-toll.
Redjo27 (Apr 2015): Maybe I was just stupid, but you should walk EAST around the tomb (don't enter), since the western way is blocked. At the northernmost point, there is a street going under the highway. Just follow that street until you get to the toll station. You cannot miss it
Note 1 : this part of the freeway until Qom is forbidden to trucks, which take the old road. Still, this spot is the best for long distances rides. Catch a lift at least until Qom and ask to be dropped before the paytoll at the entrance of Qom (if your driver leaves the freeway). From there it will be easy to catch a ride further South (Esfahan, Shiraz), including with trucks.
Note 2 : many drivers heading to Esfahan will leave the freeway at Qom and use the old road for the rest of the trip because it is cheaper!