St Johnstone nicked all three points when Brian Graham came off the bench to score the only goal on his debut after joining the club on loan from Dundee United.
The winner, which came four minutes from the final whistle, was a bit harsh on Motherwell who slumped to their fourth consecutive defeat despite looking the more likely to score in the second half.
Motherwell gave a debut to on-loan Mark O'Brien and the Derby player was quickly into action as Saints, aiming to build on their win over Aberdeen last week, forced play from the start.
After only seven minutes Chris Millar whipped in a cross which Scott Brown met on the volley just outside the six yard box but his shot was bravely blocked by Craig Reid.
A minute later Dan Twardzik made the first save of the game when Millar tried his luck from 20 yards but his drive was straight at the home keeper.
Twardzik was again in the right place when Lee Croft's cross evaded the home defence, only for Gary McDonald to head the ball into his hands.
Motherwell then had a series of shots on the visitors' goal but long range efforts from Henrik Ojamma and Paul Lawson trundled harmlessly through to Alan Mannus.
Lawson, making his first appearance of the year after a lengthy injury, then broke into the visitors box only to watch his low drive blocked by Tam Scobbie.
While there was plenty of play towards both there was little to worry either keeper. On the half hour mark Twardzik was tested but this time Scott Brown's drive was easily saved.
Just before half-time, Ainsworth curled in an inviting cross which found John Sutton but his header drifted away from goal.
The Fir Park striker had the first chance of the second half, but from an angle he shot tamely at Mannus.
Ten minutes into the half the Saints goal had a double escape. Firstly Ainsworth's cut back was cleared only as far as Reid, whose drive cannoned off Scobbie, with the home side screaming for handball. From the resulting corner Sutton's downward header was net-bound until the grounded Mannus cleared the ball with his feet.
As the pressure on the visitor's goal mounted Tommy Wright replaced Croft with Michael O'Halloran, before Motherwell made their first change sending on striker Lee Erwin for Josh Law.
It was O'Halloran, though, who came closest to scoring when his cross struck the outside of the keeper's left hand post.
In a final attempt to break the deadlock Saints sent on former Well player Simon Lappin and on-loan striker Graham.
The game looked to be heading for a draw after Twardzik held a McDonald header before the Saints sub finally found the net four minutes from time. McDonald crossed from the right inviting Graham to rise in front of the home defence and head powerfully beyond the keeper.
Why are you making commenting on The Herald only available to subscribers?
It should have been a safe space for informed debate, somewhere for readers to discuss issues around the biggest stories of the day, but all too often the below the line comments on most websites have become bogged down by off-topic discussions and abuse.
heraldscotland.com is tackling this problem by allowing only subscribers to comment.
We are doing this to improve the experience for our loyal readers and we believe it will reduce the ability of trolls and troublemakers, who occasionally find their way onto our site, to abuse our journalists and readers. We also hope it will help the comments section fulfil its promise as a part of Scotland's conversation with itself.
We are lucky at The Herald. We are read by an informed, educated readership who can add their knowledge and insights to our stories.
That is invaluable.
We are making the subscriber-only change to support our valued readers, who tell us they don't want the site cluttered up with irrelevant comments, untruths and abuse.
In the past, the journalist’s job was to collect and distribute information to the audience. Technology means that readers can shape a discussion. We look forward to hearing from you on heraldscotland.com
Comments & Moderation
Readers’ comments: You are personally liable for the content of any comments you upload to this website, so please act responsibly. We do not pre-moderate or monitor readers’ comments appearing on our websites, but we do post-moderate in response to complaints we receive or otherwise when a potential problem comes to our attention. You can make a complaint by using the ‘report this post’ link . We may then apply our discretion under the user terms to amend or delete comments.
Post moderation is undertaken full-time 9am-6pm on weekdays, and on a part-time basis outwith those hours.
Read the rules hereComments are closed on this article