Togo took the last quarter-final place at the African Nations Cup to maintain the flow of outsiders into the last eight at the end of the group phase on Wednesday.
A 1-1 draw with Tunisia in Nelspruit ensured the point they needed to finish second behind the Ivory Coast in Group D and a first place in the last eight after failing in their seven previous attempts.
The Ivorians, fielding their second-string side but restoring Didier Drogba to the team, came from two goals down to draw 2-2 with Algeria in a dead rubber in Rustenburg having already secured top place.
Togo now join the other unfancied countries, the Cape Verde Islands and Burkina Faso, in the knockout stage of a tournament strewn with upsets.
They will face Burkina Faso in the last of the quarter-finals on Sunday in Nelspruit.
Togo faced a surprisingly timid showing from former winners Tunisia, who had to win the game to progress, plus several controversial calls in a game in which South African referee Daniel Bennett took centrestage.
Bennett awarded Tunisia a penalty in each half, denied Togo captain Emmanuel Adebayor a legitimate-looking claim and booked the wrong Togolese defender in a final 20 minutes of near pandemonium at the Mbombela Stadium.
Khalid Mouelhi's failure to convert the second penalty in the 78th minute effectively cost his side their chance to progress but, in truth, Tunisia lacked the necessary attacking rigour to force the desired result.
Mouelhi did score the first spot-kick on 30 minutes when Dare Nibombe was penalised for holding on to Tunisia's Walid Hicheri in a wrestling tussle as he was defending a corner.
Tugging and pulling between players at set pieces has become commonplace and largely unchecked but Bennett bucked the trend by awarding a penalty.
Togo had the cushion of an early goal in the 13th minute when Serge Gakpe looked offside as he collected a sublime pass from Adebayor but the goal was allowed to stand.
Adebayor's penalty appeal came as he wriggled free of the Tunisia defence to go one-on-one with goalkeeper Moez Bin Cherifia and went tumbling down as he attempted to round him.
Togo were still arguing the decision to ignore the claim when Bennett handed another penalty to Tunisia, again against Nibombe for clipping Saber Khalifa from behind. It further inflamed an already ill-tempered affair and four Togo players were booked in quick succession.
However, Mouelhi struck his shot against the upright.
"Togo showed its quality and its heart. I'm very happy for Togo, we were the little team in this group," said coach Didier Six.
Ivory Coast coach Sabri Lamouchi made nine changes from the team who beat Tunisia 3-0 to qualify for the quarter-finals, resting players ahead of the quarters.
He restored Drogba, who has admitted he is in need of proper match fitness, for a meeting between the two top-ranked African sides that, ironically, had no bearing on the group's outcome.
All four goals at the Royal Bafokeng Sports Palace came in a 16-minute spell in the second half with Algeria, already eliminated after losing their first two matches, taking the lead in the 64th minute with substitute Sofiane Feghouli scoring two minutes after coming on for Ryad Boudebouz, who missed a penalty in the first half.
They doubled their lead six minutes later when Hilal Soudani thundered in a header after escaping his marker and meeting a long perfect cross from Feghouli wide on the right.
The Ivorians struck back in the 77th minute when Drogba outjumped the defence to head home.
They equalised three minutes later when a powerful shot from Wilfried Bony took a huge deflection off Algerian defender Djamel Mesbah.
The Ivorians next meet Nigeria in Rustenburg on Sunday.