Tunisia edged past Ghana 5-4 on penalties in their last-16 tie on Monday after a 1-1 extra-time draw to take the last place in the Africa Cup of Nations quarterfinals.
Ferjani Sassi netted the decisive kick in the shootout as Tunisia kept up their unconvincing progress in the tournament where they next meet rookies Madagascar in the last eight on Thursday.
Tunisia opened the scoring against the run of play when striker Taha Yassine Khenissi netted 17 minutes from time.
But an own goal in stoppage time let Ghana back in and forced the game into extra time as defender Rami Bedoui, who had just come on in a bid to shore up the defence, headed into his own net attempting to clear a lofted free kick from Jordan Ayew.
Tunisia were on the back foot for most of the contest and created few chances but when one came Khenissi proved clinical as he timed his run perfectly to tuck away a cross from flying full-back Wajdi Kechrida in the 73rd minute.
He got in ahead of two defenders to steer it home and break the deadlock in a match where Ghana were the more adventurous but were twice denied by the woodwork.
They did have the ball in the Tunisia net four minutes before half-time but the goal was not given by South African referee Victor Gomes, who ruled that Thomas Partey had handled the ball in the buildup.
Television replays did not support his decision but Partey was offside anyway before he laid the ball off for Dede Ayew to finish.
Ghana centre back Kasim Adams headed against the upright from a corner in the 15th minute and Mubarak Wakaso struck the bottom of the post near the end of the game.
The introduction of Wahbi Khazri, who had been doubtful before the game, proved a tonic for Tunisia and he had a powerful strike in extra time that Ghana goalkeeper Richard Ofori did well to tip over the bar.
With five minutes left Jordan Ayew might have won it for Ghana but miscued his shot and watched in agony as his close-range effort went wide.
Tunisia changed their goalkeeper just before the shootout although Mouez Hassen looked perplexed and angered by coach Alain Giresse's decision to replace him with Farouk Ben Mustapha.
But it proved a master stroke as Ben Mustapha's save from Caleb Ekuban in the shootout handed Tunisia success.
The stalemate after two hours of football means Tunisia are in the last eight despite four draws at the tournament, having laboured through the group phase.