A stoppage-time goal from Yasser Ibrahim helped Ahly earn a comeback 2-2 draw at Sudan's Al-Merreikh to qualify for the African Champions League quarters with one match to spare in Group A on Saturday.
Two first-half goals from Ramadan Agab and Saifeldin Malik put Merreikh on the verge of claiming a famous win but Ahly vastly improved after the break to restore parity, thanks to a penalty from Badr Benoun, who otherwise committed some costly errors, and Ibrahim's late header.
Despite sealing passage to the last eight, Ahly will still rue their inability to finish on top of the group. They are now second with eight points, five behind leaders Simba of Tanzania, who crushed DR Congo's Vita Club 4-1 in the other group game.
The defending champions will now face a tough opponent in the quarter-finals, with Tunisia's Esperance and South Africa's Mamelodi Sundowns ensuring their progress as winners of their respective group, while Morocco's Wydad are also likely to finish on top.
Two goals down
Ahly created the first real chance when forward Mohamed Sherif, who formed a two-pronged attack along with striker Marwan Mohsen, volleyed over with the goal at his mercy after Magdi Afsha found him unmarked with a square pass.
But the Red Devils were taken by surprise when Agab opened the scoring on 26 minutes, rising between Benoun and Mohamed Hani to send a powerful header home after a deep cross was floated from the halfway line.
Ahly then struggled to cope with Merreikh's pacy moves, with their high backline and weary-looking midfielders giving them too much room to operate.
Malik gave Merreikh a shock 2-0 lead in the 36th minute when he broke an offside trap from near the halfway line to race clear and drill the ball past keeper Mohamed El-Shennawi, with Benoun committing another uncharacteristic error.
Merreikh could have made it three without reply on the stroke of halftime but Agab fired a low spot kick wide of the post after Benoun needlessly brought down an opponent in the area.
The second half was an exciting end-to-end affair, with Ahly pouring forward en masse to salvage something from the game and Merreikh exploiting the resulting gaps to scamper goalwards and mount further threats.
Ahly's Sherif could only fire straight at the keeper after racing clear early in the second period before Agab wasted a similar attempt at the other end shortly after.
Substitute Walter Bwalya almost narrowed the gap but sent a free header over the crossbar on 76 minutes before Benoun made amends, converting a penalty with aplomb after Abdelrahman Hassan clattered into Ayman Ashraf.
Ibrahim then had the last word, heading home an inviting cross from Afsha as Ahly avoided what would have been a second defeat in their group-stage campaign.
(For more sports news and updates, follow Ahram Online Sports on Twitter at @AO_Sports and on Facebook at AhramOnlineSports.)