Togo drew 1-1 with Tunisia on Wednesday to complete the Africa Cup of Nations quarter-final cast list and send the Carthage Eagles heading back to Tunis.
In the other Group D match, the Ivory Coast also drew (2-2) with Algeria but they had already progressed as group winners as Algeria join Tunisia on the way home.
After Serge Gakpe's opener for Togo was cancelled out by Khalid Mouelhi's penalty the two countries finished level on points, with Togo owing their first appearance in the knockout stages at the seventh attempt to superior goal difference.
Mouelhi then missed from the spot late in the second half, his failure condemning Tunisia to an early exit.
The draw bagged Togo the runners-up spot in Group D and a last eight match-up with Burkina Faso on Sunday, with the Burkinabe coach Paul Put an interested observer in the stands.
Group D winners Ivory Coast meet Nigeria in Rustenburg the same day.
Togo coach Didier Six made two changes, Moustapha Salifou and Jonathan Ayite dropping to the bench and replaced by Vincent Bossou and Ayite's brother, Floyd.
Skilful midfielder Youssef Msakni started for Tunisia after overcoming a bout of tonsilitis.
Coach Sabr Trabelsi brought in Oussama Darragi, Walid Hichri and Wahbi Khazri for Fakhreddine Ben Youssef, Bilel Ifa and Anis Boussaidi.
Tunisia were once again without injured key striker Issam Jemaa. On 10 minutes Togo captain and Tottenham striker Emmanuel Adebayor almost put the little west African nation in front.
Three minutes later Togo did take the lead, with Adebayor neatly finding Gakpe, the Nantes striker slotting the ball past Moez Ben Cherifia although replays hinted at offside.
Two goal target
Tunisia, requiring two goals now to deny Togo, were struggling to make their presence felt at the Mbombela stadium.
Until the 28th minute that is when they drew back level via Mouelhi's side-footed penalty awarded when Dare Nibombe fouled Esperance midfielder Hichri.
Tunisia, buoyed by their equaliser, ended the first half the better side, and they had a justified but rejected appeal for a second penalty after the restart when Vincent Bossou felled Darragi.
Down at the other end, Adebayor skipped past a couple of Tunisian defenders, squaring the ball into the box but Komlan Amewou was unable to do the move justice.
On 69 minutes Adebayor's flying header hit the crossbar as Togo came at the Tunisians with all guns blazing again.
South African referee Daniel Bennett was arguably not having the best of games, making some dubious decisions, not least in the 75th minute when he pointed to the spot after Saber Khalifa tumbled to the floor after light contact by Nibombe.
But Togo won a reprieve when Mouelhi's poor spot kick hit Kossi Agassa's left post, and they deservedly held on to set up a date with Burkina Faso.
Saturday 2nd February
Ghana v Cape Verde 15:00 (GMT)
South Africa v Mali 18:30
Sunday 3rd February
Ivory Coast v Nigeria 15:00
Burkina Faso v Togo 18:30