St Johnstone underlined their top-six credentials with a hard-fought, if forgettable, win over St Mirren.
In the first half David McCracken headed over, while Conor Newton had a shot saved for St Mirren.
Rowan Vine broke the deadlock in 51 minutes, knocking the ball home from a corner amid poor defending.
A Frazer Wright header and two efforts from Gregory Tade came back off the woodwork as St Johnstone pressed the visitors back to grind out the result.
A home game for a team one point off a European place against opponents one place off the bottom of the Scottish Premier League suggested a straightforward win for St Johnstone.
But, so tight is the SPL this season, that the outcome of this match was hard to predict at kick-off. However, by midway through the opening half a nagging feeling had developed - this was going to end goalless.
That Vine managed to knock the ball over the line from Mehdi Abeid's corner was a welcome surprise to most observers at McDiarmid Park.
A close league, of course, is not necessarily a signifier of the quality of football on offer and this match only served to underscore that hazardous correlation.
Referee Steven McLean had booked two St Johnstone players in the first four minutes - Rowan Vine for a rash challenge on Marc McAusland and Paddy Cregg for a trip on St Mirren playmaker Paul McGowan.
The tone had been set. There were chances of a sort in the first half but they merely interrupted the fouls and misplaced passes.
McCracken powered a header over Craig Samson's crossbar from six yards, St Johnstone's first chance, and Vine thumped a 20-yard free-kick straight at Samson after 17 minutes.
St Mirren were being prompted by John McGinn and Paul McGowan in midfield and, in one of the few occasions they breached the home defence, Newton hammered a 22-yard shot that had St Johnstone goalie Alan Mannus flying to his right to save.
Mannus ran off his line to head clear in 27 minutes and did so - but only as far as Thompson who knocked the ball over the bar from 22 yards instead of lobbing it into the net.
St Mirren manager Danny Lennon would have been unhappy at the powder-puff effort on goal from 12 yards by Esmael Goncalves after he was set up by Thompson.
And he would have been miffed all the more when the home side were awarded a corner that looked like it should have gone the other way.
Then, when his defence, given several chances to do so, failed to deal with a routine corner by Abeid, Vine pounced to knock it home.
The Perth Saints should have gone two ahead when Wright headed Murray Davidson's inviting cross from the right off the crossbar.
Perhaps embarrassed by his earlier attempt, a pumped-up Goncalves blazed wide from the same position as the visitors pushed for a leveller.
Steven Anderson let fly with a shot from 25 yards that sailed wide and substitute Tade hit the bar with a header from close range.
St Mirren huffed and puffed, their final ball often their weakest point.
And when sub Lewis Guy was foiled in the six-yard box, smothered by blue shirts on the point of firing home, it typified the Buddies' day.
In the final minute of injury time Tade hit the post with a header, the third time the Perth Saints had hit the woodwork in the second half, exaggerating the excitement on offer.
Follow Keir Murray on Twitter.
- 01 Mannus
- 03 Davidson
- 05 Wright
- 06 Anderson
- 18 McCracken
- 04 Cregg Booked
- 08 Davidson
- 10 Craig
- 21 Abeid (Tade - 61' )
- 17 MacLean Booked (Hasselbaink - 82' )
- 23 Vine Booked
- 15 Tuffey
- 02 MacKay
- 33 Scobbie
- 14 Gwion Edwards
- 16 Doughty
- 09 Tade
- 11 Hasselbaink
- 01 Samson
- 02 van Zanten (Guy - 70' )
- 03 Dummett
- 14 McAusland Booked
- 06 Goodwin
- 10 McGowan
- 17 Mclean
- 24 Newton
- 09 Thompson
- 29 J McGinn (Carey - 81' )
- 77 Goncalves
- 16 Adam
- 05 Mair
- 23 Barron
- 11 Carey
- 07 Imrie
- 19 Parkin
- 27 Guy