Beiranvand was on hand again to deny Hakim Ziyech on 80 minutes, with a diving low save which proved to be even more valuable when Bouhaddouz headed the ball into his own net deep into stoppage time.
Relive how the late drama unfolded with Sports Mole's minute-by-minute updates below.
3.00pmYou know you have well and truly been struck by World Cup fever when you are excited about the prospect of Morocoo vs. Iran at 3pm on a Friday. Group B's two major underdogs get their campaigns underway at the Krestovsky Stadium in Saint Petersburg, and you can catch every mediocre kick live here with Sports Mole.
3.02pmRESULT: Before we get to this afternoon's teams, news to bring you from today's early kickoff in Group A where it was tears for Egypt's Mohamed Salah, who, nursing his shoulder injury, watched from the bench as Jose Gimenez's late header snatched Uruguay a 1-0 win.
3.04pmMOROCCO: El Kajoui; Achraf, Benatia, Saiss; N. Amrabat; El Ahmadi, Boussoufa, Harit; Ziyach, Belhanda; El Kaabi Subs: Bono, Mendyl, Da Costa, Fajr, Boutaib, Bennasser, Dirar, En-Nesyri, Bouhaddouz, S. Amrabat, Tagnaouti, Carcela-Gonzalez
3.08pmA disappointing blow for Morocco sees Nabil Dirar again miss out with the calf injury that kept him out of his country's recent friendlies against Slovakia and Estonia. Twenty-year-old Schalke midfielder Amine Harit takes the Monaco winger's place on the right side.
3.10pmThere are plenty of recognisable faces in the Morocco lineup, namely Juventus star Mehdi Benatia who anchors a defence that was watertight in qualifying. Real Madrid youngster Achraf Hakimi and Wolves utility man Romain Saiss also occupy the back four.
3.12pmFurther up the pitch, former Watford midfielder Nordin Amrabat is another starter in manager Herve Renard's lineup, while Ajax playmaker Hakim Ziyech has been well thought of for a few years. This could be the platform for him to make his anticipated breakthrough.
3.14pmMidfielder Saeid Ezatolahi miss out due to suspension, so versatile captain Masoud Shojaei will be used in the centre of the park, while Renard has prefered Ayoub El Kaabi up top over Khalid Boutaib - the man whose goals played a big part in Iran's qualification.
3.16pmIran are managed by former Manchester United assistant manager and one-time Real Madrid boss Carlos Quieroz, who has been in charge of the country for seven years but will step down after this World Cup, which is Iran's second in a row for the first time ever.
3.18pmQuieroz has plenty of attacking firepower to call upon and has partnered captain Sardar Azmoun, who has scored 23 times in 33 international appearances, with Alireza Jahanbakhsh, who netted 21 times for club side AZ last term to top the Eredivisie scoring charts.
3.20pmDespite becoming the first Asian player to top the goalscoring charts in one of Europe's major leagues, the 24-year-old forward has yet to replicate his club form at international level with an underwhelming four goals in 37 caps so far. Now would be a great time to start!
3.22pmThis is the first time in 20 years that Morocco have qualified for the World Cup finals, with their last appearance at France '98 in which they were knocked out in the group stages despite beating Scotland 3-0. Former Spurs defender Noureddine Naybet and ex-Coventry duo Youssef Chippo and Mustapha Hadji, who is now the assistant manager, were a part of that squad.
3.24pmAll in all, Morocco have been to four previous World Cups, with their best run in 1986 when they reached the last 16. They have been knocked out in the group stage on three of their four occasions.
3.26pmTheir 2018 contingent actually enter this tournament as one of the form teams, having gone unbeaten in 18 matches over the course of the last 14 months, which has seen them rise to 41 in the FIFA World Rankings, above the likes of Greece, Czech Republic and Scotland. This whole commentary is not a subtle Scotland bashing, I swear.
3.28pmWith European champions Portugal and heavily-tipped Spain to come, this Iran game is absolutely crucial to Morocco's chances of upsetting the odds by qualifying from Group B. However, Morroco have never won an opening game in the competition, drawing two and losing two.
3.30pmMorocco have won only two of their 13 games at the World Cup, including five defeats in their last seven games. However, this is surely the best squad that Morocco have brought to the tournament with their squad littered with players who play regularly in Europe's top leagues.
3.32pmThe key to Morocco's recent success has been their defence, which is anchored by Benatia. They only conceded one goal during eight CAF qualifying games - against Equatorial Guinea - and did not let in a single goal in six matches in the pool stage, the only side on the continent to achieve that.
3.34pmAlthough he has talents such as Ziyech and Younes Belhanda in his armoury, Renard has built this Morocco team on the basics. In CAF quailfying, they ranked topped the charts for long balls, winning second balls, and successful tackles.
3.36pmIt would take a brave man to dispute Renard's methods, too. This is the French coach's first World Cup, but he already has a track record of winning major tournaments. The 49-year-old is the only manager to win the African Cup of Nations with two different teams - Zambia and Ivory Coast.
3.38pmQuieroz himself takes a pragmatic approach. Iran were unbeaten in their qualifying campaign - including the playoff matches - winning 12 games out of 18 in which they also kept 14 clean sheets.
3.40pmHowever, Iran have only ever kept one clean sheet in their 12 World Cup games - 0-0 v Nigeria in 2014 - so Quieroz will have to use all of his experience to help his side transition to this big stage.
3.42pmExperience is certainly something that Quieroz has in abundance, even at this elite level. This is his third successive World Cup as a manager, with his best finish the last 16 with Portugal in 2010.
3.44pmIran didn't make it out of the group under Quieroz in 2014, and indeed never have made it past the first hurdle in all four of their previous appearances at the tournament. The draw this time around has done them no favours either, with Quieroz justifiably describing Group B as "the hardest group".
3.46pmJune 21st, 1998 - the date of Iran's only ever World Cup victory, which came against the United States in the form of a 2-1 win, which is also the only time that they have ever scored more than once in a match at the Finals.
3.48pmHEAD TO HEAD: Morocco and Iran have never met at the World Cup. In fact, they have faced each other only once previously, a game which ended in a draw, a result which would do neither team any favours today.
3.50pmAround 10 minutes until kickoff now in Saint Petersberg, with this match a curtain-raiser for tonight's other Group B showdown between European heavyweights Portugal and Spain - another match you can follow in great detail with Sports Mole.
3.52pmThe 67,000 capacity of the Krestovsky Stadium is slowing filling up which is good to see after a disappointing turnout for Uruguay's win over Egypt earlier today...
3.54pmPREDICTION: These two teams have misely defences so it could be a question of who is going to be brave enough to push for all three points. Morocco certainly have more individual quality and I think that will be enough to pinch them a 1-0 win.
3.56pmA mark of that individual talent in the Morocco squad is that Southampton winger Sofiane Boufal did not even make the squad. Boufal had a poor season but is capable of the spectacular, as seen with his Goal of the Season contender against West Brom, so those that made the cut must be decent!
3.58pmKickoff is imminent here as the two teams line up for the national anthems. I'm waiting for the day that Sri Lanka qualify - their anthem is a doozy. I may be waiting a while...
1 minKICKOFF: The Turkish officials - led by referee Cuneyt Cakir, who infamously sent off Nani in Sir Alex Ferguson's last Champions League game at Manchester United - signal for play to start!
3 minIt has been a really lively start from Morocco and they may have taken an early lead had the excitement of the occasion not got to the head of highly-rated Schalke youngster Harit, who screwed a shot wide from the edge of the box.
5 minAmrabat has the beating of Cheshmi down the right and he knocks in a cross which Belhanda cannot direct on target with a difficult header. We know from his Watford days that Amrabat has decent delivery but he gave his mate a lot to do there.
7 minThe Africans are already knocking on the door but again the composure is lacking in the finish as El Kaabi drags a shot wide from just inside the box, after finding space in between the centre-backs.
9 minYELLOW! The early pressure on the Iran rearguard has forced their skipper Masoud Shojaei into a cynical early tackle, a nasty rake down the Achilles of Moubarak Boussoufa, which rightly earned him a yellow card.
11 minIran venture forward for the first time, but only succeed in endangering themseleves as goalkeeper El Kajoui easily claims a cross and rapidly starts a counter-attack with some intelligent distribution. The Iranian defenders retreat in panic but just about quell the threat.
13 minThe opening stages of this match suggest that Iran goalkeeper Alireza Beiranvand could be in for a busy afternoon. His journey to Russia is more remarkable than most - he was working at a car wash when Iran played at the last World Cup. And that is only half of the story...
15 minQuieroz will be alarmed by the one-sided nature of the first 15 minutes but Iran appear to have survived Morocco's adrenaline-fueled barrage and the game is beginning to settle at a less-frantic pace.
18 minCHANCE! I spoke too soon, with Morocco's best chance yet falling to Benatia after Iran made a horrible mess of clearing their lines. Beiranvand throws himself across his goalline and a block from one of the defenders in front of him helps them get the ball behind for a corner.
20 minReferee Cuneyt Cakir stops play before the resultant throw-in to check on a potential handball during that penalty box melee, but it comes to nothing, and neither does the set piece. No VAR controversy so far at the World Cup, but I'm sure it won't be long!
22 minCHANCE! Morocco are caught short at the back and Iran spring on them with a three-on-three break, playing it perfectly to release Jahanbakhsh inside the left edge of the area, but he completely scuffs his attempt to direct the ball back across goal for either a shot or a pass.
24 minCaptain Azmoun takes the ball into feet and tries an ambitious shot on the turn while holding off Benatia, but he cannot wrap his foot around the shot and it sails a long way wide.
26 minThe Moroccan FA have done some serious digging to discover some lost grandmother's of several Dutch and French-born players!
28 minIran's belief has grown visibly in the last five minutes or so and they are now confident enough to stroke their way out of a precarious defensive position on the left with Belhanda and Boussoufa lurking.
30 minSHOT! Harit skips past a few Iranian defenders and shapes to bend a shot inside the far post, but can only hit it straight at Beiranvand from the corner of the penalty box.
32 minRouzbeh Cheshmi has had a tricky half-hour with Amrabat and Harit both running at him regularly, but the Iran left-back has just had half a chance to send his side into the lead after he latched onto a loose ball from a free kick, but he lifts his shot over the crossbar.
34 minYELLOW! Former Aston Villa midfielder Karim El Ahmadi enters the book for a very similar tackle for which Iran's Shojaei saw yellow earlier in the half, a deliberate trip on Azmoun as the forward tried to break away.
36 minJahanbakhsh lines up the resultant set piece from 35 yards out but skies the ball high into the stands. The AZ striker certainly hasn't lived up to his billing as Iran's danger man so far.
38 minAzmoun requires treatment from the Iran physio for a mysterious injury received off the ball. Judging from where the medic is focussing his attention, it could be a twisted ankle but it seems as though the striker will try to battle through it.
40 minZiyech comes to life on the Morocco left and his vicious cross is just out of reach of the rather static El Kaabi, who has not done much to justify his selection so far. Morocco good be a force with a decent striker as they have plenty of creativity behind him.
42 minCHANCE! What an opportunity for Azmoun, who was through one-on-one with El Kajoui but lost his balance and ended up shooting tamely at the Morocco goalkeeper from point-blank range. Morocco have a reputation for being solid at the back but Iran have already exposed a couple of chinks in their armour, so just think what Portugal and Spain might be able to do.
44 minTwo Iranian players simultaneously eye World Cup glory as they run onto an unconvincing clearing header from Achraf, but they get in each other's way and the danger passes despite a silky attempt at a recovery from Ansarifard.
45+1 minEhsan Haji Safi is the latest Iran player to dream of his name up in lights but his piledriver from a 35-yard free kick was never troubling El Kajoui in the Morocco goal as it lacked the direction to match the power.
4.54pmThe half-time scoreline suggests that this has been the tight, low-scoring affair that many expected and while the second part of that assumption is right, there have actually been chances at both ends with Morocco starting well and Iran growing into the game as the half went on.
4.56pmMedhi Benatia's main job in this Morocco team is to anchor their defence but the Juventus centre-back had the best opportunity to give his side the lead but he could not fully capitalise on a goalmouth scramble. Meanwhile, Sardar Azmoun passed up Iran's clearest chance on the stroke of the break.
5.00pmThe atmosphere inside the Krestovsky Stadium has been brilliant from the first whistle. There are some musical instruments being played which are very reminiscent of the Vuvuzelas from South Africa 2010. Oh god, they aren't making a comeback are they? Although I think I may still have mine somewhere...
5.02pmBENCH WATCH:Herve Renard may be looking at a swap up top, with El Kaabi having been very disappointing so far and Khalid Boutaib an established goalscorer in reserve. Iran have former Fulham and Nottingham Forest winger Ashkan Dejagah to call upon, although will probably hold him back for the last 20.
46 minKICKOFF: We are back underway in Saint Petersberg, with both sides unchanged for now.
48 minMorocco have begun this second period in the same sort of positive fashion that they did the first. El Ahmadi lifts a lovely ball into the right channel for Amrabat to run onto but his cross is nowhere near a teammate in the middle.
50 minYELLOW! Things didn't go to plan for Iran's golden boy Jahanbakhsh in the first half and his second half hasn't started much better, with the Turkish referee showing him a yellow card after he caught Ziyech on the foot.
52 minAmrabat continues to be a really good outlet for Morocco and this time there is more precision to his delivery which finds Harit, who cannot control a volley which comfortably clears the crossbar.
54 minMoments before that Harit volley, Iran wasted a promising opening when Azmoun's sloppy pass is intercepted by Achraf. The forward had carried the ball threateningly from the halfway line but then undid all of his good work. He is wasteful again here by knocking a cross straight behind for a goal kick.
56 minA stoppage in play to allow Ebrahimi to recover from an awkward collision with Harit grants Iran the luxury of a breather after another fast start to a half from Morocco. The Iranians will hope that they can respond as well as they did before the break, and then hopefully pinch a winner.
58 minOnly a few thousand short of capacity at the Krestovsky Stadium which is not a bad effort for an early group game of such little fanfare. They have enjoyed a half-decent game, but it needs a goal now...
60 minEl Ahmadi whips a wonderful left-footed pass around the back of the Iran defence, but Achraf cannot bring the ball under control having made an adventurous run out from defence.
62 minThat is nasty from Ziyech, who has no chance of getting the ball as Haj Safi safely ushers it out of play, and he takes his studs to the back of the Iranian's leg. The Ajax playmaker, who has very much been on the periphary of this game, is lucky to get away without a booking there.
64 minIran counter-attack from a Morocco corner but Jahanbakhsh ignores the option of Shojaei on the overlap and the momentum of the break is lost as he cuts inside and eventually loses the ball.
66 minSUBSTITUTION: Quieroz blinks first to try to end this stalemate, surprisingly replacing his captain Shojaei, who has been booked, and bringing on Mehdi Taremi of Al Gharafa, who is a slightly more offensive player.
68 minIran have enjoyed around 30% of possession throughout this match so set pieces could be their route to victory. They have a good opportunity to load the box here but the delivery from Amiri is horribly overhit.
70 minAmiri skips past Achraf with a mazy dribble into the box but is box is cut out by Saiss, who had a fine season in midfield for Wolves but operates as part of the back three for Morocco.
72 minDID YOU KNOW? The Moroccan football team's nickname is 'Lions of the Atlas'. That is majestic; so royal. It would be a shame to see them knocked out for that reason alone.
74 minAmrabat appears very dazed after an awkward landing by the right byline. There will be heavy scrutiny on concussion protocol at this World Cup and Morocco have rightly eered on the side of caution, after one of the physios literally tried to slap the concussion out of him. Not sure that will help, pal.
76 minSUBSTITUTION: Mixed feelings for the Amrabat family as Sofyan Amrabat replaces wobbly older brother Nordin. The former Watford was clearly struggling even as he walked down the tunnel.
78 minSUBSTITUTION: Renard quickly makes another change as Aziz Bouhaddouz comes on for El Kaabi, who has been pretty ineffective as Morocco's lone striker.
80 minSAVE! Belhanda skilfully juggles the ball 25 yards from goal and sets up Ziyech with a low-stopping headed layoff which the Ajax man meets with a sweet left-vooted volley. Beiranvand needs all of his 6ft 4in frame to tip the shot around the post.
82 minSUBSTITUTIONS: A change apiece to report, with Ebrahimi forced off for Iran after taking a blow to the ribs, and Pejman Montazeri coming on. Renard makes the final Morocco change with Manuel da Costa, once of West Ham, replacing Harit out wide.
84 minSUBSTITUTIONS: Players from both teams are dropping like flies here. Jahanbakhsh's poor afternoon is compounded as he leaves on a stretcher, although, it didn't look too serious. Saman Ghoddos from Swedish side Ostersunds is on. And that is that for substitutions now.
86 minHe has not always been a central figure in this game, but if anyone looks like making something happen here it is Ziyech, whose left-footed shot from 25 yards out is blocked.
88 minAmrabat the second knocks a hopeful but decent cross to the back post but the defender stands firm under pressure from Real Madrid man Achraf, who is almost playing as a winger now as Morocco push for a winner.
90 minUruguay supplied us with some late drama earlier - can Morocco or Iran do the same here? The former appear the most likely but we are down to stoppage time now, albeit six mintues of it.
90+2 minYELLOW! Iran midfielder Ansarifard takes a late yellow card for the team, and Morocco's frustrations are starting to boil over either side of the touchline. Renard has to be held back by his coaching staff, but quickly calls a truce by extending a hand to shake with Quieroz.
90+4 minA clever run from Ghoddos across Amrabat draws a foul which gives Iran the chance to load the box. It is right over by the left byline but far enough up the pitch to cause Morocco to twitch.
90+6 minIncredible scenes in Saint Petersburg as Iran snatch three points at the death! The delivery into the near post should be comfortably cleared, but substitute Bouhaddouz sends his header past his own goalkeeper and into the bottom corner. Morocco can't believe it, and neither can Iran as their whole squad storms the pitch to celebrate their first FIFA World Cup win in 20 years!
6.08pmThere was late drama in today's early kickoff and now this 2018 World Cup has come up with another stoppage time goal, one which earns Iran only their second ever win in Finals history, and takes them to the unlikely spot of top in Group B. With Spain and Portugal to come, Morocco have a long way back.