Gabon was left to rue an astonishing early miss by star striker Pierre-Emerick Aubameyang which might have changed the complexion of a largely disappointing game in the Stade de l’Amitie.
In injury-time, there was more agony for home supporters as Denis Bouanga saw his shot hit the post and Cameroon goalkeeper Fabrice Ondoa made an astonishing save to tip over the follow up from Didier Ndong
Burkina Faso went through as group winners after beating minnow Guinea-Bissau 2-0 in Libreville.
An own goal and second half strike from Bertrand Traore, the Chelsea player on loan at Dutch side Ajax, settled it for the Stallions.
Gabon, looking to build on a pair of 1-1 draws with Guinea-Bissau and Burkina Faso, with Borussia Dortmund star Aubameyang scoring in both, made a strong start in search of the win which would have put it through.
First Bouanga saw his shot smothered by Ondoa from close range.
But then came the miss of this or any tournament as Bouanga’s cross left Aubameyang with a gilt-edged chance from just a few yards out.
But he was left with his head in his hands after scuffing the effort with his studs just wide.
With Burkina Faso in charge of the other Group A game after an early own goal by Rudinilson Silva, Gabon knew that a draw was not enough before its home fans in Libreville.
The early chances proved the best until the late drama, while Cameroon offered little in attack aside from an Ambroise Onyongo shot which brushed the post.
But the Indomitable Lions held out to join Burkina Faso on five points from three games with an inferior goal difference
Gabon is only the fourth host to go out at the group stages and the first since Tunisia in 1994.
Coach Jose Antonio Camacho refused to discuss his own future after his side’s exit, but remained defiant.
“I am sorry for the fans and for the team. We went out to win the game but football is not fair, and we hit the post in injury time before their goalkeeper made a great save from the follow-up,” Camacho told AFP.
“It was the opposite against Guinea-Bissau, when we lost a goal at a set-piece in the 91st minute.”
Burkina Faso, the 2013 runner-up, will play its quarterfinal in Libreville next Saturday, with Cameroon taking on Senegal in Franceville on the same day.