The five-time winner needed a victory to claim second spot in Group B after its shock defeat to CAPS United last week.
It started in strong fashion in Cairo and took the lead through Bassem Morsi after 13 minutes, but Mahmoud Hamdi El Wensh was sent off for a second bookable offence after conceding a penalty in first-half injury time, allowing Mohamed Al Ganodi to equalise from the spot.
Vianney Mabide put the Libyan side 2-1 up after 69 minutes to put the game firmly under their control, and although Moruf Yusuf equalised to set up a nervy final quarter of an hour, the visitors held out to claim their last-eight spot.
Al Ahli goes through in second place in the group behind USM Alger - a comfortable 4-1 winner over CAPS United.
In Group C, Mamelodi Sundowns lost out on top spot to ES Tunis after being held to a 1-1 draw by AS Vita Club.
Yazid Atouba cancelled out Thabo Nthethe's opener in Pretoria to deny the holder any hope of snatching first place in the standings.
Tunis finished three points clear at the top thanks to a 4-0 win over Kedus Giorgis courtesy of goals from Khalil Chemmam, Bilel Mejri, Haythem Jouini and Ali Machani.