Morocco star Hakim Ziyech's 90th-minute penalty miss cost his side dearly as Benin went on to win 4-1 on penalties and reach the quarter-finals of the African Cup of Nations for the first time.
Youssef En-Nesyri's equaliser 14 minutes from time got Morocco back into the game after Moise Adilehou's shock opener and it seemed like they would go through when Benin skipper Stephane Sessegnon felled Achraf Hakimi in the box.
Ziyech sent the goalkeeper the wrong way but saw his effort come agonisingly hit the outside of the post.
Benin played 23 minutes of extra time down to ten men after Khaled Adenon was dismissed for apparently shoving the referee, a second bookable offence.
He left the pitch very reluctantly before engaging in an argument with the Moroccan bench and it remains to be seen if he will play again in the tournament.
The underdogs looked to have been looking to get to penalties from the first minute and their accomplished kicks suggested as much. In contrast Morocco appeared nervy in the shoot-out with Sofiane Boufal blazing over the bar and Youssef En-Nesyri seeing his kick saved.
More Sports Headlines
- Guardiola: They have to fix VAR
- African Games: Black Satellites win opener against Burundi
- VAR denies Man City again against Spurs
- Kroos piledriver helps Real Madrid win at Celta but Modric sees red
- Mane and Firmino give Liverpol win at Southampton
- Dortmund crush Augsburg to set title marker in season opener
- Lacazette and Aubameyang give Arsenal the edge over sturdy Burnley
- Former Nigeria great Samson Siasia handed life ban by Fifa
- Aduriz, 38, scores stunning goal as Athletic Bilbao beat Barcelona
- Coutinho set for Bayern Munich loan move
- Ghana's Patrick Twumasi joins Turkish club on loan
- Skyy FC owner unhappy with Normalisation Committee's draft statutes
- Andre Ayew focused on Swansea amid transfer rumours
- Liverpool goalie could miss Southampton game after pitch invader injured his ankle
- Hazard out of Madrid season opener with thigh injury