Near the end of a dull first half, the Gers left-back fired in from 16 yards for his first goal in almost two seasons and it proved decisive for a 1-0 victory.
The fourth-round tie had been the subject of a ticket row between Saints fans and the Perth club's board after Gers supporters were allocated three stands, and the home support looked to be in the hundreds.
However, the advantage the Govan men had in the crowd was hardly translated on to the pitch and in general it was an unconvincing and laboured performance by the Ibrox men.
Michael Beale has won eight and drawn one since taking over as Light Blues boss, but work remains to be done as he looks to rebuild the squad.
Amid the ongoing debate about the merits of the Rangers goalkeepers, 40-year-old Allan McGregor was back between the sticks with Ryan Jack and Malik Tillman also returning.
Saints had lost their previous five fixtures and boss Callum Davidson rang the changes, with James Brown, Cammy MacPherson, Daniel Phillips, Melker Hallberg and Connor McLennan coming back into the side which ran out to see around 7,000 travelling fans and made it feel like the game was at Ibrox.
However, yet again it was a far from blistering start from Rangers, but they had the first chance in the 16th minute when Ryan Kent crossed from the left for fellow attacker Fashion Sakala but he wildly volleyed wide of the target.
The home side were fighting their corner and threw the ball into the Gers box almost at every opportunity looking to exploit the hesitancy which had been present this season.
Rangers could not get into top gear but in the 38th minute Barisic curled a free-kick from 25 yards past Remi Matthews' left-hand post.
It looked like the first half was going to end goalless when St Johnstone defender James Brown went off with an eye injury to be replaced by Graham Carey, but the Govan men struck.
Sakala took a clever pass from Tillman and crashed a low drive against the far post, with Matthews beaten, but on-rushing Barisic quickly drove the rebound high into the net from just inside the box for his first goal since scoring a penalty against Royal Antwerp in February 2021.
Barisic almost set up Rangers' second goal in the 56th minute when he sent in a corner which was met by the head of fellow defender Connor Goldson, but Matthews made a fantastic save and the home side cleared to safety.
Both teams made changes off the bench. For the home side Nicky Clark and Theo Blair replaced Stevie May and Hallberg while Rangers brought on Scott Wright and Glen Kamara for Sakala and Tillman, before Gers midfielder Jack drove wide with a pot-shot from distance.
Wright drew a fine save from Matthews with a curling shot before striker Alfredo Morelos' poorly struck effort from close range was cleared off the line by defender Andy Considine.
At the other end, Rangers skipper James Tavernier scooped a flick from Blair off the line after the visiting defence had conceded their first real chance.
In the final minute of normal time Clark tested McGregor with a decent drive and Rangers were hanging on nervously at times in the closing minutes.