De Kock steers Proteas to first win after Afghanistan collapse