Ahly reached the Egypt Cup's final eight after a hard-earned 4-3 win over Minya in the round of 16 on Sunday.
Minya, who defeated heavyweights Ismaily in the last round, was a stiff opponent for Ahly, who were clearly affected by the absence of some of their key players due to injury.
Striker El-Sayed Hamdy gave Ahly an early lead on the 25th minute, but Minya forward Mahmoud Atef quickly scored the equaliser after only five minutes.
Starlet striker Amr Gamal added the second goal for Ahly on the 57th minute, followed by the third from rookie midfielder Bambo just six minutes later.
While things were going well for Ahly, defender Mahmoud Kaoud stunned the Cairo giants with two successive goals in only 10 minutes to restore the balance.
Striker Amr Gamal continued his superb performance, scoring the winner for Ahly in stoppage time.
Ahly's win is a good boost ahead of Saturday's anticipated Cairo derby against rivals Zamalek in the Egyptian mini-league.
Earlier on Saturday, Zamalek booked a place in the Egypt Cup quarter-finals after beating Ghazl El-Mahalla 2-1.
(For more sports news and updates, follow Ahram Online Sports on Twitter at @AO_Sports and on Facebook at AhramOnlineSports.)