The visitors, now 10 points clear of Morton, struck on 22 minutes, with Aidan Connolly finishing off a swift counter-attack.
Ross Callachan then shot home to double the Fife side's advantage.
St Mirren responded before half-time, with Alex Cooper forcing the ball in from close range.
However, the hosts, seeking a third successive victory to reignite their slim play-off hopes, could not break through the Rovers defence again.
The Buddies, who had manager Alex Rae sent to the stand by referee Barry Cook, remain seventh in the table, 14 points behind the Kirkcaldy men.
It was a first away success for Rovers since December and closes the gap on third-placed Hibernian to seven points.
Raith Rovers strengthened their grip on fourth place in the Scottish Championship by beating St Mirren for a third time this season.