India secured a thrilling 11-run victory over South Africa in the third T20I, taking an unassailable 2-1 series lead.