Mozambique and Zambia advanced in the Africa Nations Championship (CHAN) qualifiers after coming through their first-round ties.
Mozambique made it to the next round despite a 3-0 defeat in Namibia, who had brought the tie back on level terms on aggregate to take the game to extra-time then penalties.
Namibia looked doomed after a three-goal first-leg hiding in Maputo, and a goalless first 45 minutes in Windhoek did nothing to alter that view.
But then Riaan Cloete broke the deadlock six minutes into the second half, volleying a Deon Hotto cross into the net and offering a glimmer of hope to the Brave Warriors.
Mozambique, who edged Namibia 1-0 in the recent regional Cosafa Cup, were reduced to 10 men when striker Apson Manjate was sent off for two bookable offences.
Namibia began to believe all was not lost and Roger Katjiteo hammered a loose ball into the net four minutes from time to stir a previously subdued crowd.
Katjiteo struck again two minutes into stoppage time, chasing a long pass and scoring with another fierce shot that sparked wild celebrations on the touchline and in the stands.
But there was no fairytale finish as the Mozambicans regained their composure to convert all five penalty kicks while Chris Katjiukua missed for the Namibians.
Zambia reached the final round of qualifiers by beating visiting Botswana 2-0 to sail through 3-1 on aggregate.
The bronze medallists at the first CHAN tournament in Ivory Coast four years ago, were firm favourites to oust Botswana after forcing an away draw with 10 men.
But it took a side guided by 2012 Africa Cup of Nations-winning French coach Herve Renard 49 minutes to score on the Zambian Copperbelt.
Giant striker Festus Mbewe inflicted the damage, nodding a chip from defender Kondwani Mtonga past recalled Botswana goalkeeper Noah Maposa.
Defender Obuile Nncenga was sent off, leaving the Zebras to pursue an equaliser a man short and their fate was sealed 12 minutes from time when Evans Kangwa netted.
A second-half substitute for Bornwell Mwape, striker Kangwa sprinted on to a pass from star midfielder Mukuka Mulenga to score from close range and seal Zambia's passage.
Mozambique will now take on Angola, while Zambia will face Zimbabwe in the second round of qualifiers in the Southern Zone, with the winners making it through to the finals in south Africa next year.