The Flames missed the chance to go top of Group F earlier in the day when
Chimango Kayira's late own-goal earned Kenya a 2-2 draw in Blantyre.
After Robin Ngalande's 46th-minute opener was cancelled out by Jamal Mohammed (52), the hosts retook the lead through Robert Ng'ambi with nine minutes remaining only for Kayira to put through his own net one minute from time.
Malawi were then at the mercy of Nigeria, who could have sealed top spot and a last-10 berth with a later victory in Windhoek, but Namibia's Deon Hotto
Kavendji had other ideas.
His 77th-minute goal caused panic before Godfrey Oboabona equalised seven
minutes from time, but Stephen Keshi's men head off to the Confederations Cup knowing a home defeat to Malawi in September will deny them the chance to reach next summer's World Cup.