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 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.
New subway station much closer to below described highway toll station. It's name is Aftab Town (شهر آفتاب) - "shah-r aftaab" in farsi. Try it out and write here how you walked from the subway to toll station!
Take the metro to Haram-e-Motahar (حرم مطهر) (Red Line). Walk across Imam Khomeini tomb, under the highway bridge and South along the Freeway to the roadside parking just after the toll station. Overall it's more than 2km of walking but definitely worth it. You can choose your ride from all the cars with people taking a break.
Note 1 : this part of the freeway until Qom is forbidden for 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 toll station 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!