Namibia had lost 4-0 to the South Africans in the pool stage, but showed a vastly improved performance as edged the play in the decider and claimed a deserved win in the shoot-out.
But that goal spurred South Africa into action and they claimed an equaliser with 20 minutes to go when influential midfielder Thabiso Monyane found the back of the net.
Monyane had a magnificent chance to win it late on, but put his shot wide when well-placed and the game went to penalties, with Namibia keeper Josef Phillipus proving the hero.
Malawi grabbed the bronze medal with a deserved 2-0 victory over an improved Kenya in the third-place play-off.
Malawi had beaten the East African guest nation 5-0 in the pool stages but found them a much tougher nut to crack this time round.
They had to wait until the 58th minute to open the scoring when Peter Banda netted his fifth of the competition, making him the leading scorer for the COSAFA Under-17 Championships this year.
They doubled their lead with three minutes to go when Francisco Madinga netted to make the win safe.
SUNDAY’S THIRD-PLACE PLAY-OFF FIXTURE
Kenya 0 Malawi 2 (P.Banda 58’, Madinga 87’)
SUNDAY’S FINAL FIXTURE
South Africa 1 (Monyane 70’) Namibia 1 (Awaseb 64’)
Matches Played: 16
Goals scored: 48
Biggest victory: Malawi 5 Kenya 0 (Group B, July 26)
Most goals in a game: 5 – Malawi 5 Kenya 0 (Group B, July 26); Seychelles 1 Namibia 4 (Group A, July 27)
5 goals – Peter Banda (Malawi)
4 – Abram Tjahikika (Namibia)
3 – Eldery Morgan (Namibia), Nicholas Mulilo (Zambia)
2 – Franck Chizuze (Malawi), Damiano Kola (Zambia), Luke le Roux (South Africa), Francisco Madinga (Malawi), Linamandla Mchilizeli (South Africa), James Monyane (South Africa), Fabrizio Mosa (Madagascar), Kenneth Mukuria (Kenya), Siphamandla Ntuli (South Africa), George Nyimbili (Zambia)
1 – Godwin Awaseb (Namibia), Raphael Banda (Malawi), Bonga Dladla (South Africa), Neehal Hurdoyal (Mauritius), Mathiot Juninho (Seychelles), Rivaldo Laksman (Namibia), Mswati Mavuso (South Africa), Mjabulise Mkhize (South Africa), Matteo Monple (Mauritius), Kunda Nkandu (Zambia), Benjamin Phiri (Zambia), Tyreese Pillay (South Africa), Mwiza Siwale (Zambia)