Namibia scored a late winner against Uganda on Thursday in Marrakech to qualify for the quarter finals alongside regional rivals Zambia as Uganda crashed out.
For the third time running, Uganda has failed to go past the group stage of the tournament designed exclusively for footballers playing in their domestic leagues.
Substitute Panduleni Nekundi scored deep in added time to secure debutants Namibia a place at the knockout stage.
The two substitutes combined for the winner with Itamunua Keimuine playing Nekundi who was lurking at the far post and he wasted no time to fire straight past the keeper to the roof of the net.
Uganda dominated possession and chances but lacked the cutting edge to go past the resolute Namibia rear.
Juma Sadam rose high to head Isaac Muleme's inviting cross over the goal with seven minutes on the clock.
The Cranes kept mounting pressure on Namibia's goal and Allan Kyambadde saw his effort blocked after Milton Karisa's set piece was fumbled by Namibia keeper Loydt Kazapua.
Kazapua was called to action after 25 minutes parrying away Muleme's free kick just outside the box.
Namibia's diminutive forward Hendrik Somaeb tried his luck from a distance but failed to threaten the Ugandan keeper with his effort going wide on the half hour mark.
Somaeb missed his side's best opportunity after 35 minutes latching on to Vitapi Ngaruka's first time through pass but his chip beat on rushing Isima Watenga and over the goal.
The Cranes tough they were in a for a goal when captain Bernard Muwanga's long ball over the top was headed to Muzamiru Mutyaba by Sadam but defender Epson Karongee intervened with a last ditch tackle to keep the score level.
Kazapua pulled another athletic save 20 minutes into the second half from a Kyambadde header after a neat inter-play with Karisa. Kyambadde broke on the left channel cutting in curler inches wide off Kazapua's goal.
Uganda were reduced to ten men on 76 minutes when defender Awany Dennis received his second yellow for a foul on Nandjebo Theophilus who was headed for goal.
Ricardo Mannetti's charges kept on pushing for the winner and for the second match running they scored in the 92 minute through Panduleni Nekundi.
The victory secures Namibia a place in the quarter finals alongside Zambia who earlier triumphed 2-0 over Cote d'Ivoire courtesy of Augustine Mulenga's brace.