|Co-hosts Gabon progress to the quarter-finals where they will be joined by Tunisia who earlier beat Niger 2-1 [AFP]
Gabon made it into the Africa Cup of Nations quarter-finals after a classic and almost surreal 3-2 win over Morocco in Libreville on Friday.
Morocco, with an injury time penalty, believed they had done enough to keep their Cup hopes alive, but that was not counting on Bruno Mbanangoyes's curling free kick in the final second of the eighth minute of stoppage time of a remarkable encounter.
Gabon had been on the brink of winning in normal time after goals from Pierre-Emerick Aubameyang and Daniel Cousin deep into the second half had put them in command after Houssine Kharja's opener.
But, as the stadium announcer urged the 40,000 partisan supporters to "remain calm, remain calm" Kharja appeared to have spoiled Gabon's night when stepping up to coolly convert the 91st minute spotkick awarded for Charly Moussono's handball.
Then along came Mbanangoye to seal all three points which not only put Gabon into the last eight but Tunisia too, who earlier defeated Niger 2-1.
Morocco and Niger are heading home.
Reflecting on the stunning win Gabon coach Gernot Rohr said: "The final 15 minutes were truly dramatic. I must say bravo to my players.
"Our fortunes turned when Pierre-Emerick Aubameyang scored. Now we'd like to finish top of the group, then we can stay in Libreville."
Morocco coach Eric Gerets was bemused how the game had slipped from his team's grasp, and marvelled at the dramatic finish.
"My heart was going 200 beats a second!
"I have to congratulate Gabon's coach and his team, they'll have a big party in Gabon tonight, but I would have preferred a big party in Morocco."
Gerets made four changes from the opening defeat to Tunisia.
The Belgian chose to start Arsenal striker Marouane Chamakh, laid low with a stomach bug this week, on the bench, where he was joined by Noureddine Amrabat, Mbark Bousoufa and Ossama Assaidi, recovering from an Achilles tendon injury.
Rohr adopted the policy 'if it ain't broke don't fix it' by naming the same side that saw off Niger 2-0 on Monday.
As they had done in their opening match Gabon chased and harried their north African visitors from the start.
But on 24 minutes Morocco injected some much needed life into their campaign when Younes Belhanda found Kharja in the middle of the area, the Fiorentina midfielder losing his marker and shooting low and left-footed past Gabon keeper Didier Ovono Ebang.
At the restart Gabon introduced Cousin for Stephane Nguema and Morocco replaced Youssef El Arabi with Noureddine Amrabat.
Cousin's introduction almost paid immediate dividends when the former Hull City striker raced onto a cute backpass from Aubameyang over in the right-hand corner, his venomous shot smacking off keeper Nadir Lamyaghri's outstretched hands.
On the hour mark Remy Ebanega was stretchered off with blood pouring from his mouth, the defender returning to the field of battle with a bandaged head.
Queen Parks Rangers striker Adel Taarabt then entered the fray as Morocco tried to kill the game off.
But Gabon got the equaliser they deserved in the 77th minute when Aubameyang volleyed in right-footed in a move begun by a long throw in from the left touchline.
Seconds later Cousin sent the 40,000 crowd into ecstasy when bagging what he and the rest of his teammates thought was the winner, skilfully turning to lose his marker, the ball going in off the right post.
But the game had only just begun, as Kharja converted from the spot and then Dinamo Minsk midfielder Mbanangoye became a national hero.