Jon Daly headed a late winning goal for Raith Rovers to leave St Mirren searching for their first home win in the Championship this season.
The Buddies had been very sluggish for almost all of the first half and were lucky to be level at half-time after Lawrence Shankland had cancelled out James Craigen's 12th-minute opener.
Shankland and Calum Gallagher came close to scoring St Mirren's second.
However, a long throw-in by Rory McKeown was headed in by Raith's Daly.
Midfielder Grant Anderson had ghosted through the static Saints defence and claimed to have got the final touch on the six-yard line.
While that remains debateable, there was no doubt he did enough to distract St Mirren goalkeeper Jamie Langfield and help Rovers to their first away points of the season and third place in the table behind Rangers and Falkirk.
For almost all of the first half St Mirren looked as if they were still stunned by losing 3-2 to Falkirk last week despite holding a two-goal lead.
Their creative players seemed to be lacking in confidence and there were precious few attacks.
Craigen's opening goal for Rovers hardly came as a surprise. St Mirren failed to clear their lines and gave Craigen too much time and space to clip in a lovely goal from 18 yards.
And it could have been worse for St Mirren when twice Raith's captain Jason Thomson crossed for Daly who just could not connect properly, once with his head, once with his boot, both at the back post.
Keith Watson moved forward from defence to sweep in the perfect cross from the right for Shankland whose header was saved by Kevin Cuthbert.
And as St Mirren came to life, on the stroke of half-time the same duo combined, with Shankland slipping home a low shot from a narrow angle from Watson's clever pass.
Raith had lost their previous three Championship games away from home, all against the league's stronger sides – Falkirk, Hibs and Rangers.
And when St Mirren played the second half with renewed spirit it looked like the Fifers would have to wait longer for a win or even a point.
Shankland had two shots diverted from the target before a third effort was clawed away by Cuthbert.
Cameron Howieson's left-foot curling shot drifted past Cuthbert's far post and somehow Lewis Toshney managed to deny Gallagher at the back post as he tried to convert Watson's low cross.
However, Rovers hit with a classic sucker punch when Daly nodded McKeown's throw-in past Langfield in the 87th minute.