Inverness star Reece McAlear stunned St Johnstone with a late double to leave Saints sweating over their Premiership safety.
The two clubs now go into Monday’s McDiarmid Park second leg knowing that the winner takes all in the fight to play in next season’s top-flight.
The Perth side had looked home and hosed after a convincing first half had put them 2-0 up thanks to goals from Shaun Rooney and Melker Hallberg.