A golden goal from Jyoti Kullu put India into the semi-finals of the women's hockey after South Africa seemed certain to set up a meeting with New Zealand.
The Indians trailed 3-0 at half-time and 3-1 with eight minutes of normal time left before goals from Kullu and Suman Saini drew them level.
Kullu then found the target again seven minutes into extra time after India had been awarded a penalty corner for Lindsey Carlisle's foul on Mamta Kharab.
Kullu, lurking near the goal, deflected in a shot off goalkeeper Caroline Birt's pads to complete a famous victory.
Pietie Coetzee opened the scoring for South Africa in the fourth minute and added another goal in the 13th - her eighth of the tournament - before Jennifer Wilson made it 3-0 a minute before the break.
The other semi-final will be between defending champions Australia and England, who beat Scotland 6-1.