South African footballers, coaches, supporters and media celebrated after a 0-0 home draw with Sierra Leone, believing Bafana Bafana had qualified, only to discover later that Niger had topped the table on the head-to-head rule despite a 3-0 drubbing in Egypt.
Early goals from Asamoah Gyan and John Mensah earned four-time champions Ghana a 2-0 victory in near 40 degrees celsius temperatures in Sudan, and top place in their group with 16 points from six matches.
Ibrahima Traore levelled in the final minute as Guinea salvaged a 2-2 draw against Nigeria after a dramatic second half in Abuja saw Ismael Bangura put the visitors ahead, before goals from Obinna Nsofor and Ikechukwu Uche swung the game in favour of the home team.
Zambia, Angola seal spots
Although Zambia and Libya failed to score in Chingola, the 0-0 draw took the home team through as group winners, while the north Africans are sure to fill one of two places reserved for the best runners-up.
Angola won 2-0 in Guinea-Bissau via goals from Manucho and Mateus, to finish a point ahead of long-time group leaders Uganda, who could only draw 0-0 at home against Kenya and so a 33-year wait to get back to the Cup of Nations continues.
Mali drew 2-2 in Liberia to pip Cape Verde Islands on the head-to-head rule and Tunisia, who triumphed 2-0 at home against Togo, were grateful to Chad, whose last-gasp 2-2 draw prevented Malawi from qualifying.
Ethiopia completed a miserable campaign for winless Madagascar with a 4-2 victory in Addis Ababa, Mozambique finally found their scoring boots to outclass Comoros Islands 3-0 in Maputo, and Congo defeated Swaziland 1-0 in Lobamba.