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.
They had led in Ismailia through Taha Yassine Khenissi's goal from Wajdi Kechrida's cross.
Leeds striker Ekuban was the only player to fail with his kick in the shootout, with Ferjani Sassi scoring the winning kick.
Tunisia, who last won the Africa Cup of Nations in 2004, now face surprise package Madagascar, ranked 108th in the world, on Thursday.