Previous champions Nigeria and Egypt both failed to reach the Africa Cup of Nations as qualification drew to a close.
Stephen Keshi's Nigeria side, defending champion after its success in South Africa last year, failed to win any of its opening three Group A matches but gave itself hope of a great escape by beating Sudan and Congo.
Those wins meant it was second ahead of its final game against South Africa, but a 2-2 draw saw it fail to reach the tournament proper for the first time since 2000.
Tokelo Rantie's double put South Africa in control, before Sone Aluko pulled one back in the 68th minute to offer hope to the home fans at the Akwa Ibom Stadium.
A red card for South Africa's Reneilwe Letsholonyane gave Nigeria further optimism and Aluko scored again in stoppage-time, but it was too little too late.
South Africa, which has still yet to beat Nigeria in a competitive fixture, subsequently finishes top of the group unbeaten, while Congo's 1-0 win at Sudan means it will also contest the tournament slated to start in Equatorial Guinea in January.
Egypt is also out after its chances of securing the qualifying spot for the best third-placed team were dashed when it surrendered a lead to lose 2-1 at Group G winner Tunisia.
With Tunisia and Senegal having already qualified, Egypt - the most successful team in Cup of Nations history - needed to win by at least two clear goals to earn a reprieve but fell short.
Senegal rounded off its campaign with a 3-0 win at home to Botswana.
Egypt's failure meant that Congo DR takes the vacant spot for the best of the rest after it defeated Sierra Leone 3-1 in Group D.
Cote d'Ivoire secured second spot in the pool after a 0-0 draw with group leader Cameroon - which had Stephane Mbia sent off - but the game was marred by a mass pitch invasion, which saw fans and police clash.
Ghana booked its place courtesy of a 3-1 success at home to Togo in a close Group E, from which all four teams harboured hopes of qualifying.
Ghana's defeat to Uganda last weekend meant it needed at least a point to qualify and Abdul Majeed Waris's first international goal in 13 months and a 35-yard rocket from Wakaso Mubarak put it 2-0 ahead by half-time.
Togo pulled one back shortly after the restart through Jonathan Ayite but Ghana's stand-in captain Emmanuel Agyemang-Badu made sure of the points in the 69th minute, meaning it finishes top ahead of Guinea which beat Uganda 2-0.
In Group B, Mali's 2-0 win over table-topper Algeria saw it progress at the expense of Malawi which could only draw 0-0 with Ethiopia, while in Group C Gabon overtook Lesotho courtesy of a 4-2 win and Burkina Faso ended its successful campaign with a 1-1 draw against Angola, going through top.
Elsewhere, Cape Verde Islands lost 1-0 at Zambia but both teams had qualified from Group F. The pool's other sides Niger and Mozambique drew 1-1.