Ghana, Mali complete quarter-final line-up
The permutations were plentiful before the start of play on day 12 with all four Group D teams sporting various degrees of chance to qualify, even pointless Botswana.
Saturday's quarter-finals across the border see Côte d'Ivoire tackle co-hosts Equatorial Guinea in Malabo, with Zambia against Sudan in Bata.
The Libreville quarter-final offers the intriguing sight of Mali coach Alain Giresse coming face to face with the country he managed before being succeeded by existing Gabon manager Gernot Rohr in 2010. That experience could well prove pivotal as the Frenchman plots to play party pooper for a team that still holds him in high regard.
Giresse said: "Now we have a quarter-final against Gabon. There'll be a great atmosphere, great competitiveness. We'll go away and prepare for it. Obviously I don't have to study their players and team, I know them very well. I'll put in place our strategy for the match we'd like to play."
Mogakolodi Ngele had put Botswana into the lead against the run of play shortly after the interval, with Garra Dembele grabbing the equaliser and Barcelona star Seydou Keita supplying Mali with all three points a quarter of an hour from the end.
Keita and company then had a nervous wait after the final whistle as an eerie silence descended on the L'Amitie stadium with five minutes of stoppage time being played out in Franceville.
All eyes were transfixed on the giant screen where the Ghana game was being shown. When the agonising wait was over the stadium erupted.
Mali captain Cedric Kante reflected: "We've done well tonight, mentally we showed we had resources. Now we're going to have to be demanding on ourselves to beat Gabon."
Ghana go through in top spot
Up in Franceville, Ghana went in front in the 28th minute through Emmanuel Badu with an unstoppable belter from outside the box. He collected a short corner taken by Andre Ayew and from 20 yards he let fly to give goalkeeper Naby Yattara no chance.
Dashing left winger Abdoul Razzagui Camara drew Guinea level in first-half stoppage time when his left-footed floater beat Ghana goalkeeper Adam Kwarasey. Guinea were reduced to ten men after Bah Dioulde was sent off after being booked for the second time for a cynical foul on John Pantsil.
Ghana assistant coach, Kwesi Appiah admitted it was a tough match but was delighted they finished top of the group to stay put in Franceville.
"Guinea are a good team and we knew it was never going to be easy against them," Appiah said. "Tactically we played well and we finished top of our group."
Off the pitch Zambia striker Clifford Mulenga was kicked out of the squad by coach Herve Renard for disciplinary reasons, reports suggest the player broke a curfew.
And Tunisia's 2004 title winner Adel Chedli is also heading home after a fall out with coach Sami Trabelsi.