Malabo: The African Nations Cup provided a double helping of last-minute drama on Friday as Tunisia beat Niger 2-1 and co-hosts Gabon stunned Morocco 3-2 to reach the quarter-finals.
Substitute Bruno Zita Mbanangoye curled in an exquisite free kick in the fifth minute of stoppage time to give Gabon a shock 3-2 win over Morocco, eliminating one of the pre-tournament favourites.
The victory sparked wild celebrations in the Gabonese capital of Libreville where President Ali Bongo was among the jubilant 40,000 crowd.
Tunisia`s win also came from a substitute as Issam Jemaa gave them a 2-1 triumph over Niger who were knocked out.
Tunisia and Gabon each have six points from two games in Group C while Morocco and Niger are pointless.
Despite missing big guns such as Nigeria, Cameroon and Egypt, the tournament is turning into one of the liveliest in recent years and has yet to produce a one-sided match.
Equatorial Guinea, the other co-hosts, qualified in similarly dramatic circumstances on Wednesday, a 94th-minute goal giving them a 2-1 win over Senegal and a place in the last eight.
The dullest football has come from Ivory Coast who did the absolute minimum to win their opening games against Sudan and Burkina Faso.
In the second game of Friday`s double bill, Houcine Kharja gave Morocco a 24th-minute lead, which they kept until an astonishing last 15 minutes.
Just as he did in their 2-0 win over Niger, Gabon`s inspirational striker Pierre-Emerick Aubameyang scored one goal and created the second.
The Mohican-sporting St Etienne player rifled in an unstoppable volley to equalise in the 77th minute and two minutes later set up Daniel Cousin to score with a clinical finish.
The former Rangers, Hull City, Larissa and Le Mens player collected the ball with his back to goal, spun and placed his shot just inside the far post, prompting some celebrating fans to run on to the running track around the pitch.
The stadium was in raptures until Morocco, coached by former Belgium defender Eric Gerets, were awarded a penalty for handball against Charly Moussono in the 89th minute and Kharja converted for his second goal of the game.
It was not over as Dinamo Minsk midfielder Mbanangoye`s free kick curled over the wall and inside the near post to clinch the game and send Gabon to the last eight for only the second time.
It also provided some poetic justice as the foul was awarded for a dreadful tackle by Mehdi Benatia who escaped with a yellow card when he should have been sent off.
The opening match quickly came to life with two goals in the opening seven minutes, one of them sublime and the other bizarre.
Tunisia`s left winger Youssef Msakni dribbled past four defenders before placing the ball past goalkeeper Daouda Kassaly after four minutes.
Niger were soon level when a long clearance into the Tunisia penalty area dropped with awkward back spin, fooling keeper Aymen Mathlouthi who was distracted by an attempt from Moussa Maazou to slap the ball which bounced on to the head of William Tonji Ngounou and into an empty net.
"It was important for us to our first goal of the tournament," said the journeyman striker who plays in the Swedish third division.
The chances continued to flow, both teams hitting the woodwork, before Jemaa won it on the stroke of fulltime after cutting inside two defenders to power the ball home from close range.
Ghana, who scraped past Botswana 1-0 in their opening game, face Mali in Franceville on Saturday while Botswana play Guinea, both in Group D.