Tunisia beat Ghana on penalties to set up an Africa Cup of Nations quarter final with Madagascar.
Goalkeeper Farouk Ben Mustapha was the hero, coming on for the shootout and saving Caleb Ekuban’s penalty.
Tunisia had been seconds away from winning in 90 minutes, but substitute Rami Bedoui headed into his own net in injury time, with his first touch.
Tunisia had led in through Taha Yassine Khenissi’s goal from Wajdi’s cross.
Tunisia now face Madagascar, ranked 108th in the world, on Thursday, despite not having won a game in 90 minutes. The Eagles of Carthage drew all three group games before their penalty shootout win over Ghana.
There are no games on Tuesday.