Egypt beat Ivory Coast 5-4 on penalties to reach the quarter-finals at the Africa Cup of Nations in Cameroon following a 0-0 draw.
The North Africans got the upper hand in the shoot-out when substitute keeper Gabaski saved Eric Bailly’s effort in the third round of spot-kicks.
And Pharaohs captain Mohamed Salah netted the decisive penalty to send the record seven-time champions through.
Egypt will face Morocco in the last eight in Yaounde on Sunday (16:00 GMT).
The finale was somewhat harsh on Manchester United defender Bailly, who had performed superbly at the back while sporting a rugby scrum cap on his return from a head injury.
Yet he took a short run-up for his penalty and placed his effort too close to Gabaski, who dived to his right and stuck out his left hand to push the ball onto the bar.
The Zamalek keeper had come on right at the end of the second half after Mohamed El Shenawy picked up a leg injury, and may well start against Morocco depending on the extent of the injury suffered by Egypt’s number one.
Pharaohs receive local backing
It may have ended goalless after 120 minutes but the meeting between two of the continent’s heavyweights provided plenty of openings despite the poor state of the pitch in Douala.
Two-time champions Ivory Coast had knocked out holders Algeria en route to topping their group, but Egypt had finished second in theirs after losing their opening game against Nigeria.
Cameroonians threw their support behind the Pharaohs, and the appearance of Liverpool forward Salah on the big screen in the stadium during the Egyptian national anthem was met with a loud roar.
The North Africans had the better of the first half, with Omar Marmoush rattling the Ivory Coast crossbar and Salah having two attempts tipped over by Badra Ali Sangare.
The Elephants grew into the contest and Ibrahim Sangare saw an acrobatic volley pushed away by El Shenawy.
Salah keeps nerve
Early in the second period Egypt’s Amr El Soleya blazed over when well placed inside the area while substitute Trezeguet dragged a shot across goal and wide.
El Shenawy pulled off good stops to keep out a header from Sebastien Haller and a shot from Wilfried Zaha but was then forced off.
The North Africans started the first period of extra time well, as Mohamed Sherif headed over and Sangare punched away a long-range shot by Zizo, while Gabaski denied midfielder Sangare just before the break.
Trezeguet had a late chance to win it for Egypt, but Carlos Quieroz’s side progressed after Gabaski made the crucial save and Salah kept his nerve.
Salah’s influence had waned as the game wore on but he had the final say from 12 yards, and could yet lead Egypt to their first continental crown since 2010.
Two games moved away from Douala
The surface in the Japoma Stadium had been criticised during the group stage, and the surface cut up during Tuesday’s last-16 encounter.
During the game the Confederation of African Football announced that two upcoming matches will be moved away from Douala.
Senegal’s quarter-final against Mali or Equatorial Guinea on Sunday and the semi-final which was due to be held in the port city have been switched to Yaounde.
Hosts Cameroon take on debutants The Gambia in the last eight at the Japoma Stadium on Saturday, and the Indomitable Lions will need to navigate both a tricky pitch and giant-killing opposition to continue their bid for a sixth Nations Cup title.