Stevie May's late goal gave St Johnstone a first Scottish Premiership win of the season and extended his old club Aberdeen's winless run to seven matches.
May came off the bench to squeeze the ball into the bottom corner from the edge of the box with six minutes left.
The forward celebrated joyfully in front of the home fans after a tough two-year spell with Aberdeen.
St Johnstone remain eighth while Aberdeen stay sixth after another loss.
Before May's crucial intervention, this game was heading for a dreary, goalless conclusion after a poor previous 83 minutes in which neither side produced fluid football.
The home side had most of the ball but little to show for it. Striker Christian Ramirez was twice a matter of inches from getting on the end of teasing crosses, first from Lewis Ferguson in the opening period, and then by Jack MacKenzie after the break, but was left stretching for both.
Wolves loanee Austin Samuels also cut in twice to test Zander Clark in the St Johnstone goal as his pace and trickery caused problems, but ultimately not enough to carve a goal.
The visitors offered next to nothing in the first half but grew into the game in the second 45 minutes, with Glenn Middleton twice threatening.
First he snuck in between two Aberdeen defenders to pounce on a loose ball, but he scuffed his shot and allowed Joe Lewis to make a good save.
Not long after the on-loan Rangers forward finished from just a few yards out, but the flag was up for offside after Chris Kane's flick into his path.
But May was the hero as he pounced on a loose ball before cutting inside both substitute Declan Gallagher and Calvin Ramsay and squeezing the ball into the bottom corner past an unsighted Lewis.
It was a fitting conclusion for the St Johnstone forward, who spent two frustrating seasons at Aberdeen, and he wheeled away towards the corner flag, cupping his hands to his ears after extracting revenge on his old side.
Man of the match - Efe Ambrose
What did we learn?
Aberdeen look a disjointed team. Out of Europe, out of the League Cup to lower-league opposition, and with just two wins from their first six league games, the results are far from convincing. However, with a new manager and new players still settling in, results can be forgiven if performances are creditable, but they seem to be getting worse.
Not enough creativity comes from midfield, and Christian Ramirez is not mobile enough to lead the attack all by himself. Austin Samuels was their best performer by far as his direct approach gave St Johnstone something to think about, but he was replaced on the hour mark.
Manager Stephen Glass talked with confidence pre-match about the work they had done on the training ground to improve their defensive work after a leaky spell, and they were better in that aspect, but ultimately still failed to keep a clean sheet. Glass also said the team believe in the process but at some point words need to be backed up by action.
As for St Johnstone, they will be delighted to get three points on the board. They have played well at times this season without reward, and this time they did secure victory without hitting their straps.
Ambrose was impressive on debut at the back, and Jamie McCart continues to excel, but there are little concerns defensively anyway. Manager Callum Davidson will hope for more in possession and in attack, but ultimately they produced the crucial moment.
What they said
Aberdeen manager Stephen Glass: "Disappointed and frustrated again. A lot of the ball and we get into areas in the final third and don't look like we're going to score a goal.
"It would be worrying if we weren't getting the team in situations. Obviously we want to be doing better than we are, we're getting the team in situations and it's a little bit of quality that's lacking."
St Johnstone manager Callum Davidson: "Delighted to get the win. All our efforts earlier in the season probably got us the three points. We didn't play particularly well I wasn't happy with how we got on the ball or reacted to things. But I'm delighted for the lads.
"I thought we got better as the second half went on and great for Stevie May to get the goal. Defensively we were good, just on the attacking side we can be better and make better decisions."
What's next?
Aberdeen are away at St Mirren in the league in what already looks like a must-win game on Sunday (12:00 BST) while St Johnstone will look to build on their win against Dundee on Wednesday in the League Cup quarter-final (19:45).
What did we learn?
Aberdeen look a disjointed team. Out of Europe, out of the League Cup to lower-league opposition, and with just two wins from their first six league games, the results are far from convincing. However, with a new manager and new players still settling in, results can be forgiven if performances are creditable, but they seem to be getting worse.
Not enough creativity comes from midfield, and Christian Ramirez is not mobile enough to lead the attack all by himself. Austin Samuels was their best performer by far as his direct approach gave St Johnstone something to think about, but he was replaced on the hour mark.
Manager Stephen Glass talked with confidence pre-match about the work they had done on the training ground to improve their defensive work after a leaky spell, and they were better in that aspect, but ultimately still failed to keep a clean sheet. Glass also said the team believe in the process but at some point words need to be backed up by action.
As for St Johnstone, they will be delighted to get three points on the board. They have played well at times this season without reward, and this time they did secure victory without hitting their straps.
Ambrose was impressive on debut at the back, and Jamie McCart continues to excel, but there are little concerns defensively anyway. Manager Callum Davidson will hope for more in possession and in attack, but ultimately they produced the crucial moment.
What they said
Aberdeen manager Stephen Glass: "Disappointed and frustrated again. A lot of the ball and we get into areas in the final third and don't look like we're going to score a goal.
"It would be worrying if we weren't getting the team in situations. Obviously we want to be doing better than we are, we're getting the team in situations and it's a little bit of quality that's lacking."
St Johnstone manager Callum Davidson: "Delighted to get the win. All our efforts earlier in the season probably got us the three points. We didn't play particularly well I wasn't happy with how we got on the ball or reacted to things. But I'm delighted for the lads.
"I thought we got better as the second half went on and great for Stevie May to get the goal. Defensively we were good, just on the attacking side we can be better and make better decisions."
What's next?
Aberdeen are away at St Mirren in the league in what already looks like a must-win game on Sunday (12:00 BST) while St Johnstone will look to build on their win against Dundee on Wednesday in the League Cup quarter-final (19:45).