There was agony for Gabon as the Africa Cup of Nations hosts were condemned to a group-stage exit following a goalless draw with Cameroon in Libreville.
Star man Pierre-Emerick Aubameyang was guilty of a glaring early miss while Denis Bouanga broke down in tears at the end after hitting the post at the death as the Panthers played out a third draw in as many games.
Despite ending the group stage unbeaten, Gabon become just the fourth host nation and the first since Tunisia in 1994 to be eliminated from the Cup of Nations in the group stage.
In contrast, Cameroon, after a build-up to the competition marred by the withdrawals of key players, go through to the last eight as runners-up in Group A.
Burkina Faso won the group thanks to their 2-0 victory against Guinea-Bissau in the night's other game in Franceville.
Aubameyang had scored in each of the Panthers' opening games but they could only draw 1-1 against both tournament debutants Guinea-Bissau and Burkina Faso.
However, the Borussia Dortmund striker squandered a glorious chance in the fourth minute at the Stade de l'Amitie, somehow putting the ball wide at the back post with the goal gaping after an inviting Bouanga cross.
Bouanga was the most inventive player for Gabon and he was desperately unlucky not to snatch a 94th-minute winner as his shot struck the post before Didier Ndong's follow-up was turned over by Fabrice Ondoa.
Bouanga was in tears at the end as he collected his man of the match prize, while coach Jose Antonio Camacho -- a last-minute appointment to the job -- refused to be drawn on his future as he blamed bad luck for his team's fate.
"I am sorry for the fans and for the team. We went out to win the game but football is not fair," said Camacho in reference to the last-gasp miss.
"It is too soon to talk about the future. We are sad that we have not gone through."
Aubameyang 'really proud'
French-born striker Aubameyang bemoaned a poor build-up to the tournament which included a training camp which was late in starting.
"I am really proud of all the players, of everyone, because everybody gave their all," he said.
"I thought we were stronger than every other team in the group. But it was everything, the preparation, the change of coach, it wasn't easy."
Meanwhile, Cameroon advance to the last eight and a quarter-final tie against Senegal in Franceville next Saturday.
Burkina Faso won the group thanks to their victory against Guinea-Bissau, who bow out without a win in their first ever appearance at the Cup of Nations.
A Rudinilson Silva own-goal on 11 minutes gave the Burkinabe, runners-up in 2013, the lead in Franceville.
Paulo Duarte's side then made sure of the win in the second half thanks to a 57th-minute strike by Bertrand Traore, the striker currently playing for Ajax on loan from Chelsea.
Despite losing one of their best players in Jonathan Pitroipa to injury, Burkina Faso can now look forward to a last-eight tie in Libreville next weekend against the runners-up in Group B.
Whoever that is will be decided on Monday, when Senegal face Algeria in Franceville and Zimbabwe meet Tunisia in Libreville.
Tunisia are best placed to go through as runners-up behind Senegal, while Algeria, despite the presence of African Footballer of the Year Riyad Mahrez, need to win and hope Tunisia lose if they are to go through.
"Our chances are negligible but when our backs are against the wall and we need a little sparkle to get out of a crisis, that is when we are strong. I have no worries about that," said Algeria defender Djamel Mesbah.