Rangers bounce back, Hearts knocked out of League Cup
The Glasgow giants felt aggrieved with the officiating as they bowed out of Europe's premier competition to Dynamo Kyiv in midweek after being reduced to 10 men.
However, Rangers this time had a controversial moment go in their favour as Cyriel Dessers' opening goal was only awarded after a VAR review.
St Johnstone were furious after the referee overturned his initial decision to give a foul against the Nigerian striker before he fired in his third goal of the season.
Ross McCausland added a late second for the holders to ease talk of an early season crisis.
Hearts remain without a win this season after a 2-0 defeat to second-tier Falkirk.
Ethan Ross and Dylan Tait's second-half goals eliminated last season's semi-finalists.
Spartans are the first fourth-tier side to make the quarter-finals for over a decade after they stunned top-flight Ross County 1-0.
Aberdeen needed a stoppage-time winner from debutant Topi Keskinen to see off Queen's Park of the Championship 1-0.
Celtic begin their quest to reclaim the trophy when they host Hibernian on Sunday.