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.
--- There's a new option to be verified: Openstreetmaps shows a 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.
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
December 2016: There wasn't any street around the fenced tomb complex, despite my maps app showing little streets. I went inside without being asked for payment or bag check and walked just inside of the fence, there's sort of a ring road for taxis. On the other side (that's northwest btw) there's a gate again where I left the tomb's complex. Here is also the little tunnel under the highway to get to the southbound side. 1km to the toll station. Even if one or both gates would be closed at night you can crawl under them.
September 2017: I tried the option of the subway station Aftab Town (شهر آفتاب)- "shah-r aftaab". I took the line 1 towards Kahrizak, got off at Shahed and asked (without exiting the station, you don't need to pay again) when will come the next train to "shah-r aftaab". The train came 25 minutes later on the same platform. When I exited the subway station "shah-r aftaab", the guards told me the exhibition center was closed, but I said I wanted to go on the highway, visible from the station, and they let me walk freely through the open fence surrounding the station. I walked 5 minutes to reach the highway. The emergency stop lane is wide enough for cars to pull in, so I didn't even walk to the toll station nearby. 5 cars stopped within 5 minutes, one taxi, one not my direction, I got on the third one. So this option offers decent chances I'd say.
November 2017: Even if the metro is already going to Iman Khomeini Airport we got of at "shah-r aftaab" because it is close to the toll station. Just get out the main entrance of the metro station, walk left around the fence towards the highway and stop the cars. After one taxi, one not going our direction we took the third car direct to Qom. Waited all in all maximum three minutes.
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!