Egyptian side Masry conceded a last-gasp goal as Uganda's Kampala Capital City Authority (KCCA) claimed a first-leg advantage in the CAF Confederation Cup playoff on Saturday.
It seemed as though Masry would escape with an away draw after surviving a barrage of attacks, only for KCCA to score at the death for a 1-0 win.
Substitute Derrick Nsibambi netted the vital winner for KCCA in stoppage time, volleying home from inside the area after a long free kick from keeper Benjamin Ochan eluded a defender.
KCCA were unlucky not to grab a lead earlier in the match, spurning some easy first-half chances including an effort that was denied by the woodwork.
The second leg will take place in the Egyptian city of Ismailia next Saturday.
Masry will have to overturn the deficit in the second leg if they are to book their place in the group stage of Africa's secondary club competition.
Their best result in African competitions was two semi-final appearances in the now-defunct CAF Cup Winners' Cup and CAF Cup in 1999 and 2002 respectively.
(For more sports news and updates, follow Ahram Online Sports on Twitter at @AO_Sports and on Facebook at AhramOnlineSports.)