Hi Hosko, I have done a similar trip to yours, and this is how I obtained my visas. Like you, I took around 4 months to reach Turkey, so applying for visas on the road was my only option.
I applied for both my Iranian and Indian visas in Istanbul. The Indian visa was a piece of cake - $US 50, a $A 39 "Letter of Introduction" from the Australian consulate, and a 6 day wait was all it took. Unfortunately for me, the bloke at the Iranian Consulate didn't bother sending my application to Iran for approval, and after lying me for 18 days, eventually told me so. This meant that I had to re-apply in Erzurum, where I was waiting to pick it up. The second time only took 10 days. I didn't use an agency, which seems to be a popular scam by some to extract more funds out of you. I think British citizens find the agencies easier to use, and for some reason the Iranians charge the poor old Poms much more for their visa applications than anyone else.
With regard to my Pakistan visa, I tried to apply in Istanbul but was politely told that I would need to apply in Iran. That way they can be sure that you have an Iranian visa and an Indian visa before applying. I applied in Teheran, again with a letter of introduction from The Australian consulate. The visa only took 4 days to come through, and they were a really friendly bunch. Be aware that visa applications are only accepted for about an hour in the mornings(around 10 to 11 a.m. from memory), and they are closed on Fridays.
I hope this helps in your planning. The most important thing for me was to be friendly at all times, and NEVER get upset.