The way i like to "run" with this is that following some kind of armistice in 1982, Iran then forges closer relations to USSR primarily to restock it's military, so they get a lot more gear from USSR until the 1990s at least, while there might be some kind of collaboration in Afghanistan against the US backed jihadists like bin Laden, with Iran taking a gradually inceasing role (and influence). At the same time, with both economies much less affected and much less loss of life, Iraq accelerates it's nuclear program, and Iran does same as a response. Where this goes i'd like to hear plausible scenarios too, perhaps both get the nuke in the nineties (with the americans aghasted and the israelis crapping themselves).
Some members pointed that Khomeini was far too radical in his beliefs to do what i suggest above, namely reproachment with USSR and a nuke program, but as apparently there was a coup attempt against him in 1982, you could have that succeed, so there should be an armistice with Iraq. You could also have perhaps the iraqis doing better militarily in 1980-1982 and Iran's retaking of it's territories being slower and more bloody for them, which could also lead to an armistice.