Ahmed Raouf scored in stoppage time as Egypt's Ahly survived another embarrassment to qualify for the African Confederation Cup group stage on the away goal rule following a 2-1 defeat at Morocco's Difaa Jadida on Saturday.
Jadida, who played with ten men for the last 10 minutes, looked to be heading to a surprise victory over their fancied opponents, thanks to two second-half goals from Ahmed Chagou and Johan Diderot Lengoualama which gave them a 2-1 aggregate lead after they lost the first-leg in Cairo.
Gabonese striker Lengoualama received his marching orders after receiving a second yellow card for taking off his shirt following the second goal, which sparked wild celebrations at the tiny El Abedi stadium.
However, Raouf sneaked in at the near post to convert a low cross for his first goal since joining Ahly from Libya's Ittihad Tripoli last January, helping Ahly book a last-eight spot to maintain their pursuit of Africa's secondary club competition.
The Confederation Cup has eluded Egyptian clubs since it was introduced in 2004 by merging the African Cup Winners' Cup and the CAF Cup in a single competition.
Ahly are eyeing consolation in the not-so-popular competition after suffering a stunning Champions League elimination, with the winners of the past two editions bowing out at the hands of Libya's Ahly Benghazi in the last-16 stage.
The Red Devils thwarted Jaddia's shy attempts in a cagey first half but they failed to create any goal-scoring opportunities on the break.
Jadida poured forward in the second half to carve out openings and expose the fragile defence which included sluggish duo Saad Samir and Wael Gomaa, an ageing defender who announced he would hang up his boots at the end of the season.
It was Ahly who could have opened the scoring though when central midfielder Mahmoud Hassan, known as Trezeguet, made a surging run to skip past three defenders and break clear but his low shot went just wide on 59 minutes.
Ahly were made to pay for the miss three minutes later when a late, mis-timed tackle by left-back Ahmed Shedid brought down Moustafa Flissate and defender Chagou dispatched the resulting penalty.
Lengoualama fired straight at the keeper in a one-on-one situation but he made amends in the 78th minute to give Jadid an aggregate lead.
Substitute Ayoub Nanah outpaced Gomaa on the left before squaring for the Gabonese to tap in easily into an empty net after he escaped the attention of his marker Samir.
Ahly had the last laugh, however, when Raouf made the most of some fine individual work from substitute forward Mohamed Nagy 'Gedo' to stun the home crowd and ease the pressure on beleaguered coach Mohamed Youssef.
(For more sports news and updates, follow Ahram Online Sports on Twitter at @AO_Sports and on Facebook at AhramOnlineSports.)