South Africa started the final set of group games in the lead with four points followed by Morocco and Cape Verde on two each, and Angola last with one point.
10th minute: Morocco take the lead in Durban against the hosts through Issam El Adoua and take themselves top of the standings. South Africa are still on course to qualify as long as Cape Verde do not win against Angola in Port Elizabeth.
33rd min: Angola take the lead at the Nelson Mandela Bay Stadium as Cape Verde captain Nando deflects the ball into his own net. Angola are now level on points with South Africa but still out of a qualification spot because South Africa beat them on Wednesday. Angola's only hope is for South Africa to get a result against Morocco.
71st min: South Africa equalise against Morocco from May Mahlangu's curling shot and the hosts are now top and Angola in second place.
81st min: Cape Verde equalise through Gege and suddenly the chance of a fairytale place in the last eight is on.
82nd min: Abdelilah Hafid scores for Morocco and they are back in front in the standings. It is now a perilous position for South Africa because if they lose and Cape Verde win, the hosts are eliminated.
86th min: Siyabonga Sangweni's equaliser for South Africa makes it 2-2 at the Moses Mabhida Stadium and puts them back in line for five points, but Morocco are set to finish second on a count back of goals scored, above the Cape Verdians.
90+1 min: A stoppage-time winner from Heldon means Cape Verde are guaranteed a quarter-final berth with a 2-1 win over Angola. The other game in Durban is still on with Morocco needing to score a third to go through with Cape Verde, at the expense of South Africa.
90+6 min: Final whistle in Durban sees South Africa finish top on goal difference from the Cape Verdians, both on five points. Morocco are out after three successive draws while Angola go home with a single point. (Compiled by Mark Gleeson in Durban; Editing by Sonia Oxley)