Togo qualified for the Africa Cup of Nations quarter-finals for the first time by drawing with Tunisia in an incident-filled Group D encounter.
The Togolese led after 13 minutes as Emmanuel Adebayor played in Serge Gakpe, who fired home from an angle.
Tunisia levelled through a penalty from Khaled Mouelhi shortly after, but the same player missed another spot-kick in a match Tunisia had to win to qualify.
Adebayor was denied a penalty at the other end but Togo held on for history.
Togo have qualified for their first quarter-finals, having made the first of their seven Nations Cup appearances back in 1972
The West Africans will now meet Burkina Faso in Sunday's quarter-final in Nelspruit, whose sand-filled surface has attracted scrutiny and criticism in equal measure.
Togo's passage came at a cost after Nibombe Dare and Jonathan Ayite both picked up their second yellow cards of the tournament, so ruling them out of the clash against their northern neighbours.
Dare's booking was highly controversial after South African referee Daniel Bennett, whose performance was littered with poor decisions, erroneously booked the tall defender for a challenge on Youssef Msakni when the foul had actually been committed by Serge Akakpo.
The decision for Hawks coach Didier Six, who cut an animated figure on the sidelines, is whether to appeal against the booking since Akakpo himself received a caution in the 2-0 win over Algeria.
The Frenchman's side dominated the early exchanges, with the front three of Floyd Ayite, Gakpe and captain Adebayor all combining well.
Ayite had the first chance, Adebayor then side-footed wide from 12 yards before the Togo captain slipped in Gakpe after 13 minutes.
Despite being in an offside position when the pass was played, the striker's low finish across Moez Ben Cherifia from just inside the box was allowed to stand.
Togo's 1-0 lead meant Tunisia needed to score at least twice to reach the last eight and Msakni - whose stunning strike enabled the 2004 champions to win their opening game against Algeria - launched Tunisia's first attack moments later with a strike that lacked venom.
North African failure
Tunisia's exit means that no North African team has made the last eight of the Nations Cup for the first time since 1992
Adebayor threatened at the other end when volleying wide but Togo's control on the game was checked when Tunisia were thrown a lifeline.
The Carthage Eagles won a penalty as defender Dare - who played at the 2006 World Cup - belied his experience by pushing Walid Hichri at a corner, with the Tunisian making the most of the challenge.
Despite the pressure, Mouelhi was seemingly nerveless as he wrong-footed Togo goalkeeper Kossi Agassa and slid the ball into the left-hand side of the goal.
Goals may have been in short supply in the second half but there was no shortage of incident as Bennett had a half to forget.
Shortly after the break, Togo defender Vincent Bossou brought down Oussama Darragi for what seemed a stonewall penalty - but after a long look, the official decided against it.
It was then Adebayor's turn to claim two penalties, the first of which was unconvincing whereas the second not only seemed clearcut but could also have warranted a red card for Cherifia after he got nothing on the ball and everything on the Togo striker.
After Darragi forced Agassa into a comfortable save from a free-kick, Msakni also called the Togo keeper into action - but Tunisia's best chance came after Dare conceded his second penalty as Saber Khlifa went down under another slight touch.
Mouelhi stepped up for a second time with the chance to put at least one North African side into the last eight, following the early exits of Morocco and Algeria, but he hit the post with a well-struck effort.
Tunisia coach Sami Trabelsi rang the changes as he searched a much-needed winner and he must have thought substitute Fakhreddine Ben Youssef had decided the game only for the striker to be denied by two superb saves by Agassa in stoppage time.
Six punched the air in delight at the final whistle as Togo reached the quarter-finals at a tournament from which they were originally banned by the Confederation of African Football following their withdrawal from the 2010 Nations Cup -
a decision that Fifa later helped to overturn.
Togo coach Didier Six:
"This is huge for Togo - the first time they have qualified for the quarter-finals. We were the little team in this group, and we've made it.
"I think there will be a big party in Lome tonight."
Tunisia coach Sami Trabelsi:
"We did what we had to do, we dominated the play, but we lacked a bit of finishing.
"Am I satisfied with the outcome? Not really."
- 16 Agassa Booked
- 02 Nibombe Booked
- 05 Akakpo
- 06 Mamah
- 09 Vincent Bossou
- 21 Dakonam Djene
- 08 Amewou
- 10 Ayite Booked (Ouro-Akoriko - 88' )
- 15 Romao
- 04 Adebayor Booked (Wome - 90' )
- 17 Gakpe Booked (Ayite - 75' Booked )
- 01 Atsu
- 23 Tchagouni
- 13 Ouro-Akoriko
- 19 Ametepe
- 20 Kokou
- 03 Wome
- 07 Salifou
- 12 Mani
- 14 Segbefia
- 11 Ayite
- 18 Fessou
- 22 Damessi
- 22 Ben Cherifa
- 03 Hichri
- 12 Chammam
- 20 Abdennour
- 08 Hammami
- 10 Darragi
- 14 Traoui (Ben Youssef - 87' )
- 21 Mouelhi Booked
- 23 Khazri Booked (Dhaouadi - 62' )
- 07 Msakni Booked
- 19 Khelifa
- 01 Ben Mustapha
- 16 Mathlouthi
- 02 Ifa
- 05 Dhaouadi
- 06 Gharbi
- 18 Boussaidi
- 04 Baratli
- 13 Ben Yahia
- 09 Harbaoui
- 11 Ben Youssef
- 15 Dhaouadi
- 17 Jemaa