The former Scotland striker guided home the opener in the 39th minute and soon took advantage of some slack defending to head in from a tight angle.
Motherwell came from two goals down to win against Hibernian last weekend and Bob McHugh, who netted the winner at Easter Road, again came off the bench and scored to give them hope in the final 13 minutes.
But St Mirren held on to make it seven points from three home games and end Motherwell's four-match winning streak on the road in the SPL.
The visitors began zipping the ball around but they almost conceded from John McGinn's 19th-minute corner, when Jim Goodwin managed to steer the ball on target from beyond the far post but Tom Hateley cleared off the line.
Well soon went close when Nicky Law hung a cross to the back post following a short corner and Shaun Hutchinson headed towards the top corner but Craig Samson produced a wonderful reaction save to claw the ball out.
Thompson scored his first with a clever finish from six yards. Saints kept possession after an attack was forced back and worked the ball to Marc McAusland in the right-back position. He played a one-two with Jon Robertson that sent the midfielder away down the right, and Robertson whipped in a cross that Thompson guided into the far corner.
Motherwell were then undone by a counter-attack. Some tidy play from McGinn gave Gary Teale the chance to skip past Chris Humphrey and send over a deep cross from the right. Hateley failed to get off the ground and Thompson rose to head the ball over Randolph and in off the far post from a tight angle.
The game was almost over three minutes after the break when Lewis Guy got the better of Hutchinson and cut the ball back for McGinn, who tried to steer the ball inside the far corner. However, Randolph threw himself to his left to push the ball wide.
Motherwell were having plenty of possession but were finding St Mirren a compact unit to break down and had three penalty appeals turned down by Iain Brines after the ball appeared to strike the hand of David Barron, twice, and then Goodwin.
McHugh came on in the 69th minute and soon got a chance when he met Humphrey's cutback, but Goodwin threw himself in the way of the shot to prevent a goal.
McHugh soon got Motherwell back in the game when he fired a left-footed shot in off the bar from 15 yards after good work from Ojamaa on the left but St Mirren ran out winners.