Kemar Roofe had equalised after Connor Ronan opened the scoring.
On a blustery day in Paisley the home side stunned their visitors after just four minutes when midfielder Connor Ronan fired in a wonderful drive from 30 yards.
Steven Gerrard’s men recovered to eventually level in the 41st minute through a Kemar Roofe penalty, before Colombia international Morelos, out of sorts recently, headed the visitors in front two minutes later with a landmark goal.
The second half was less eventful, but it ended in a first defeat in seven for Jim Goodwin’s side, who had started so confidently and were never out of contention.
Ahead of the visit of Aberdeen on Wednesday, Rangers are three points clear of Hearts and Dundee United and, perhaps more importantly, four ahead of Old Firm rivals Celtic, who have found form with four straight wins.
It was another test for Rangers after a crucial 2-0 Europa League win over Brondby at Ibrox on Thursday and they did enough for the win after a slow start.
The visitors were still trying to get to grips with the game when Ronan got away from Gers midfielder John Lundstram and fired a curling shot from 30 yards high past the diving Jon McLaughlin, in for Allan McGregor.
A St Mirren fan came out of the crowd to join in the celebrations but was dumped on his backside by unimpressed Saints defender Conor McCarthy.
Rangers could not find a rhythm, although in the 24th minute home goalkeeper Jak Alnwick saved a powerful Connor Goldson header from a James Tavernier corner, clutching another header from the Gers defender minutes later.
In the 35th minute Ianis Hagi had his second attempt on goal, which went wide.
However, when he was tripped just inside the box by Saints midfielder Alan Power, who had given the ball away, referee Steven McLean pointed to the spot.
Roofe slotted the penalty past Alnwick, who went the right way, and then there was bedlam when Morelos – a fan favourite since signing from HJK Helsinki in 2017 – headed in a Tavernier cross which McCarthy missed, jumping into the Gers fans behind the goal to earn a booking.
Just before the break Alnwick dived to push a Hagi shot from distance and then dived to save a Tavernier header from a Borna Barisic cross early in the second half.
Fashion Sakala replaced Morelos in the 69th minute after the Gers striker had missed the target with another drive.
Saints winger Jamie McGrath pulled up in the 83rd minute and had to be taken off on a stretcher. Having used all three substitutes, the home side had to finish the game and its seven added minutes with 10 men, a depressing end to an afternoon that had started with so much promise.