Ismahila Ouedraogo scored the decisive penalty kick as Burkina Faso beat Gabon 7-6 in a dramatic shoot-out to become the first team through to the quarter-finals of the Africa Cup of Nations after Sunday's match in Limbe finished 1-1 at the end of extra time.
Burkina Faso appeared to have the victory sewn up in normal time thanks to a first-half goal from captain Bertrand Traore, who had earlier missed a penalty.
Gabon were reduced to 10 men when centre-back Sidney Obissa was dismissed midway through the second half, but they forced extra time as the unfortunate Adama Guira helped the ball into his own net in the first minute of added time.
After there was no scoring in the extra half-hour, penalties went all the way to sudden death and Lloyd Palun became the third Gabon player to miss his kick before Ouedraogo took the Stallions through.
The 2013 runners-up advance to a last-eight tie in Garoua next Saturday against the winner of Sunday's late tie between Nigeria and Tunisia.
Gabon go home after a tournament overshadowed by the early departures of star striker Pierre-Emerick Aubameyang and influential midfielder Mario Lemina.
The two players were sent home last week without having played a minute for Patrice Neveu's side at the tournament after testing positive for Covid-19.
Their exit here means the Panthers have still never won a knockout tie at the Cup of Nations, but they can be proud of the way they battled in adversity to force extra time and penalties after Obissa's red card.
Qualification is a huge boost for Burkina Faso as the west African state deals with a jihadist insurgency.
On Sunday gunfire was reported at army barracks around the country as soldiers staged mutinies to demand the sacking of leading members of the military, prompting fears of a coup.
That could only have been a distraction for Kamou Malo's team, who should have held on in the 90 minutes without going all the way to a shoot-out.
Aston Villa star Traore cannoned his early spot-kick off the top of the bar but Burkina Faso went ahead on 28 minutes as Dango Ouattara's superb through ball was met by Traore with a first-time finish in off the post while Gabon goalkeeper Jean-Noel Amonome had come off his line.
Aaron Boupendza had a goal disallowed for Gabon for offside just before the break, and their chances of rescuing the tie were dealt a hammer blow midway through the second half when Obissa fouled Ouattara and was shown a second yellow.
Burkina Faso then had chances to kill the game off before, against all the odds, Gabon's Bruno Ecuele Manga appeared at a corner in the first minute of added time, his effort going in off the unfortunate Guira.
Abdoul Tapsoba had a goal ruled out for Burkina Faso in the first half of extra time, and he also had his kick saved in the shoot-out, but his team prevailed.