Both Iran and Morocco had their chances at goal and both were held at goalless until the injury time when Moroccan forward Aziz Bouhaddouz struck an unfortunate header into his own net to wrap up the Asians' first win in World Cup finals since 1998 in France.
However, Iran snatched the victory in stoppage time with Aziz Bouhaddouz netting an own goal following a teasing cross at the near post.
Iran have qualified for the World Cup in back-to-back tournaments for the first time.
Iran grabbed an undeserved win against Morocco in the Group D opening fixture of the 2018 FIFA World Cup in Russian Federation.
The two-foot long tube with a plastic horn at the end became a global phenomenon in 2010 and divided opinion as the instrument, widely used at games in Africa, wasn't popular with television viewers despite adding to the atmosphere.
Led by Juventus center back Mehdi Benatia, Morocco came through qualifying without conceding a goal and have four wins and a draw in their last five matches.
Morocco, who have waited for 20 years to be qualified for the World Cup again, will be facing a grim situation, against the reigning European champion Portugal and 2010 World Cup victor Spain in the next two group matches.
Showing just how much it meant, Iran's players threw coach Carlos Queiroz into the air after the final whistle.
Morocco dominated possession through the game and created a number of scoring chances, although many of them finished with shots off target.
Morocco, chief instigators of the vuvuzela revival, lost out in their attempt to host the 2026 World Cup, beaten by the joint US/Canada/Mexico bid, which means, thankfully, the vuvuzela's imprint on major worldwide football tournaments will be a temporary one.
As was expected, defensive-minded Iran sat in for most of the match awaiting opportunities to counterattack, while the high-octane Moroccan side played a positive match.
He said: "We must already focus on Iran". "We have 80 million people happy in the streets everywhere in Iran and it is such an incredible feeling". Both Morocco and Iran qualified for Russian Federation being unbeaten in their qualification campaign in their respective zones.
After it was initially unfurled, during the first half of the game, there was a brief commotion as it was put away. A smooth talker? His team certainly looked the smoother of the two in the first half, despite being "the great under-achievers in African football" according to Matterface.