As an Iranian I like to add that cultures never stay the same and always evolve like a living creature, these days the thumbs up gesture does not really indicate anything offensive anymore.
Being kinda westernized it is now the like-gesture (you all know the source), people now often use it to show approval of what the other one said or did. Though in some outlying regions it might still mean rude which I consider totally rare.
Yet we don't use the thumbs up gesture for hitchhiking, we just hold a hand forward like you want to shake hands and optionally shaking it a little up and down for getting better attention.
And you should know, it's just not illegal and everyone can actually give rides to people and take money for it which makes free hitchhiking rare in Iran. Instead it's very popular and many people will stop to get you somewhere and take some money in return. So when someone pulls over, he is expecting you to tell your destination then they will suggest a price (often low) and if you accept it you can jump in.
Finally to add something about foreigners in general, Actually Iranians are very interested in foreigners (you might often notice them gathering around you or eyeing you up LOL, just don't panic), so as a foreigner you might get free rides more (except taxis who might try to get double from you).