Steven MacLean went from villain to hero with the winning goal for St Johnstone in the Scottish Premiership match against Aberdeen at McDiarmid Park.
The Saints striker hit the outside of the post when clean through on goal in the first half and Gary McDonald also missed a golden chance for the Perth side before Dons defender Andrew Considine hit the bar with a header.
There was little between the teams in a disjointed second half but with 10 minutes remaining MacLean was much more efficient in front of goal when he was set up by Michael O'Halloran, steering the ball low past Jamie Langfield from 12 yards to seal a 1-0 home win.
After two successive league defeats, the Scottish Cup holders were glad to get back to winning ways.
Howver, the Dons had successfully applied for a postponement of last week's fixture against St Mirren due to their heavy early season schedule, which included six Europa League qualifiers. After that rest period, boss Derek McInnes will surely be disappointed with his side's performance.
Aberdeen were followed down to Perth by a travelling support of around 3,000 - but it was the home side who looked the more promising in the opening stages.
In the 10th minute midfielder Chris Millar's wayward strike from 25 yards following a cleared St Johnstone corner elicited jeers from the Pittodrie fans but it fooled everyone by landing at the feet of David Wotherspoon on the byline.
It seemed like Dons defender Mark Reynolds had to lean on Dave Mackay to stop the Saints skipper getting on the end of the cross just a few yards from goal, with referee Craig Thomson uninterested in the penalty claims.
MacLean, however, should have opened the scoring in the 20th minute when Dons winger Johnny Hayes inexplicably passed the ball straight to him, allowing the Saints striker to run clean through on goal.
However, despite having time and space - or maybe because of it - MacLean never really looked confident and with Langfield barring his way, he clipped the outside of the post with his drive.
Moments later, however, the Dons goalkeeper did not look too clever when spilling a long-distance free-kick from MacLean - but former Dons midfielder McDonald, albeit under pressure from Reynolds, knocked the ball wide from six yards.
Aberdeen at last bucked up their ideas and came back strongly.
Considine bulleted a header from a Shaleum Logan cross off the bar before Saints defender Steven Anderson managed to clear - and the home side were happy to survive a short spell of intense pressure.
David Goodwillie replaced striker Adam Rooney on the hour before O'Halloran came on for Saints midfielder Lee Croft - but the game was becoming increasingly scrappy.
Aberdeen forward Niall McGinn took a fresh air swipe in the 70th minute when Hayes had rolled a free-kick across the box to him. It seemed as if a goal would never come, as the Northern Irishman moments later stretched to head a Logan cross over the bar from close range.
In between those two incidents, Saints new signing Simon Lappin, formerly of Motherwell and Norwich, came on to make his debut at the expense of Scott Brown.
There were two more unconvincing penalty claims by the McDiarmid Park men when Mackay's cross hit Peter Pawlett and an O'Halloran effort struck Considine.
However, with 10 minutes to go MacLean made amends for his first-half howler when, with the Dons defence sleeping, he smartly turned in O'Halloran's cross past the diving Langfield, before being booked by Thomson for his wild celebration which involved his top coming off.
The visitors threw everything forward and moments later, Saints keeper Alan Mannus blocked a close-range drive from Goodwillie before Pawlett was booked for simulation after going down in a challenge by Anderson, who helped hold the home defence together until the final whistle.