Ismailia - Tunisia defeated Ghana 5-4 on penalties on Monday with Ferjani Sassi converting the decisive spot-kick to end a 54-year Africa Cup of Nations losing streak against the Black Stars.
After a 1-1 draw following extra time in Ismailia, Tunisia scored from all five penalties while Ghana substitute Caleb Ekusan had his attempt saved by Farouk Ben Mustapha, who came off the bench especially for the shootout.
Victory was sweet for Tunisia as they had lost six times to Ghana in the African football showcase from 1965 after drawing the first meeting between the nations two years earlier.
On Thursday, the Carthage Eagles play giantkillers Madagascar in a quarter-final in Cairo with the winners meeting Senegal or Benin for a place in the July 19 final.
Losing on penalties ended a Ghana run of six consecutive top-four finishes in the Cup of Nations and puts the future of coach Kwesi Appiah in doubt.
Four-time former champions Ghana changed two of the team that began a 2-0 win over Guinea-Bissau that enabled them to pip Cameroon for top spot in Group F on goals scored.
Both alterations were on the left side of a 4-3-3 formation with defender Nuhu Kasim and midfielder Afriyie Acquah replacing Joseph Aidoo and Owusu Kwabena.
Tunisia coach and 1980s France star Alain Giresse reacted to an embarrassing 0-0 draw with minnows Mauritania in their previous match by dropping four of the team.
A big surprise was the exclusion of forward Wahbi Khazri, who had been the outstanding Tunisian attacker in the group phase and scored one of their two goals.
Bassem Srarfi, Naim Sliti and Karim Aouadhi were also relegated to the bench with Ghaylen Chaalali, Ferjani Sassi, Taha Yassine Khenissi and Anice Badri promoted.
After early yellow cards for Ghanaian John Boye, the first player to be red-carded in the group phase, and Tunisian Dylan Bronn, the first half became a cagey, even affair.
Ghana came close to scoring on 16 minutes when a Kasim header struck the post and Andre Ayew fired the rebound straight at goalkeeper Hassen Mouez.
Andre Ayew was convinced he had put the Black Stars ahead on 41 minutes when he backheeled a cross into the net, but the referee ruled that Thomas Partey handled in the build-up.
Replays showed the ball touching the chin of the Atletico Madrid midfielder rather than a hand and the disallowed goal infuriated the Ghanaians.
Midway through the second half Giresse had second thoughts about the composition of his attack, which was making little impression, and sent on Khazri in place of Badri.
Khazri needed just five minutes to make an impact with his brilliant backheel creating space for Wajdi Kechrida to cross and Khenissi scored with a shot that went in off the near post.
The woodwork foiled Ghana a second time when a Mubarak Wakaso shot from outside the box struck the far post 10 minutes from the end of regular time with Mouez beaten.
In the first minute of stoppage time, the Blacks Stars drew level with an attempted headed clearance by Bedoui looped over Mouez, who had strayed off his line.