CAF Confederation Cup Wrap: Al Ahly progress
Mohamed Youssef's men took a slender 1-0 advantage into the second leg in Morocco thanks to Abdullah Said's strike, but they were almost sent crashing out by their determined opponents.
Al Ahly are only in this competition after seeing the defence of their CAF Champions League title ended last month.
And when Ahmed Chagou's 62nd-minute penalty levelled the aggregate score and Johan Lengoualama put Difaa El Jadida 2-1 up 16 minutes later, they were facing elimination from the second-tier tournament too.
But in the fourth minute of injury time, Ahmed Raouf scored to give Al Ahly a crucial away goal.
Saturday's other game was far more straightforward, as Sewe Sport cruised through to the group stage by beating Bayelsa United of Nigeria 1-0 on the day, 3-0 on aggregate.
Sewe headed to Sapele simply needing to keep things tight, but they ultimately snatched a late victory to ensure their passage.
Christian Koffi Kouame converted an 89th-minute penalty as Sewe secured their place in the competition's group stage for only the second time.