St Johnstone leapfrogged Aberdeen to go fifth in the Scottish Premier League with a win against the Dons in Perth.
Gregory Tade made Isaac Osbourne pay for a sloppy mistake to gave Saints the lead at McDiarmid Park but Niall McGinn hit an emphatic close-range leveller.
The home side went ahead again in the second half with a fine hooked goal by Rowan Vine after Liam Craig's corner.
Then Dave Mackay finished off a nice Saints set-piece to give his side a two-goal cushion and all three points.
Aberdeen had won both previous meetings of these teams in season 2012/13.
In fact, it was May 2011 when St Johnstone last beat the Dons.
Saints manager Steve Lomas returned to the dug-out for the first time since completing his eight game touchline ban.
And the first chance of the game went to the home side in the sixth minute.
Craig's out-swinging corner was met by St Johnstone defender Frazer Wright, but his goal-ward header was cleared off the line by Stephen Hughes.
It took Aberdeen until the 17th minute to muster a real effort on goal and it came via Scott Vernon, whose 20-yard right-footed effort skimmed comfortably wide of Alan Mannus's post.
On the half-hour mark McGinn, who has been in unbelievable form for the Dons this season, cut inside to shoot from the right corner of the box but Callum Davidson deflected the effort wide.
Tade then had a great opportunity to put Saints one up when Vine put him through, however Jamie Langfield saved the Frenchman's shot well with his foot.
Those home fans cursing Tade's miss were cheering him moments later, though.
Dons defender Osbourne fluffed a 33rd minute pass-back, Tade capitalising beautifully by rounding Langfield and netting his fourth goal of the season.
Aberdeen rallied and McGinn's cross was almost put in at the back-post by Rory Fallon.
But with half-time approaching, the Dons did find a way back into the match.
Josh Magennis deceived Davidson excellently on the right wing before sending in a perfect ball for McGinn to get in ahead of Mackay and hammer it into the net from close-range.
The Northern Irishman's strike took him to 16 goals for the campaign and made Craig Brown's half-time team talk slightly easier.
Aberdeen's Scott Vernon found himself deployed in a more attacking role in the second period and saw a six-yard snap-shot deflected over on 50 minutes.
Then the lively St Johnstone duo of Nigel Hasselbaink and Tade worked a nice one-two before the former side-footed wide from the edge of the box.
Craig scored a lovely goal for Saints against Motherwell recently and almost got another here - his rising 25-yard effort sailing just wide on the hour.
Soon after, the home side were reminded of McGinn's menace when he cut inside Davidson to thrash the ball into the side-netting.
But then the game turned with two quick-fire St Johnstone goals.
Another Craig corner caused panic in the Dons box on 68 minutes, with Langfield failing to collect and the ball coming off Magennis' head for Vine to hook home expertly into the top corner.
Just over a minute later, Mackay was on hand to finish off a very well-worked free-kick which Steven MacLean eventually cut back to the Saints captain.
Aberdeen brought on Rob Milsom, Johnny Hayes and former Saint Peter Pawlett to try to inspire a comeback in the final 20 minutes.
But it was not to be and St Johnstone got their first win against the Dons in over 18 months.
Live Text Commentary
Full Time The referee blows his whistle to end the game.90:00 +1:37
The official flags Niall McGinn offside. Indirect free kick taken by Alan Mannus.90:00 +1:01
Inswinging corner taken right-footed by Niall McGinn from the left by-line, David MacKay makes a clearance.90:00 +0:50
A cross is delivered by Niall McGinn, blocked by Liam Craig.89:35
Free kick taken by David McCracken.89:35 Booking
Booking Joe Shaughnessy is shown a yellow card for unsporting behaviour.89:23
Unfair challenge on Michael Doughty by Joe Shaughnessy results in a free kick.88:03
Johnny Hayes produces a cross.87:15
Free kick awarded for a foul by David MacKay on Peter Pawlett. Free kick crossed left-footed by Robert Milsom, Thomas Scobbie manages to make a clearance.86:40
The ball is sent over by Josh Magennis, save made by Alan Mannus.84:23
Shot from just outside the box by Liam Craig goes over the bar.82:47 Substitution
Substitution Thomas Scobbie replaces Rowan Vine.82:17
Corner taken by Robert Milsom.81:45
Outswinging corner taken by Robert Milsom.81:21
Robert Milsom takes a shot. Blocked by Frazer Wright.81:02
The ball is crossed by Niall McGinn, clearance by David McCracken.80:18
Centre by Josh Magennis, save by Alan Mannus.76:00
The referee blows for offside. Free kick taken by Alan Mannus.75:25 Substitution
Substitution Robert Milsom on for Isaac Osbourne.74:32
Corner taken left-footed by Liam Craig from the left by-line, save by Jamie Langfield.
Substitution (Aberdeen) makes a substitution, with Peter Pawlett coming on for Rory Fallon.73:18
Effort on goal by Rory Fallon from just inside the area clears the bar.71:52
Isaac Osbourne fouled by Michael Doughty, the ref awards a free kick. Jamie Langfield takes the free kick.71:03
Free kick taken by Callum Davidson.71:03 Booking
Booking Stephen Hughes is cautioned by the ref for unsporting behaviour.71:00
Free kick awarded for an unfair challenge on Liam Craig by Stephen Hughes.69:34
Assist on the goal came from Steven MacLean.69:34 Goal scored
Goal! - David MacKay - St J'stone 3 - 1 Aberdeen David MacKay finds the back of the net with a goal from close range high into the middle of the goal. St Johnstone 3-1 Aberdeen.68:54
Foul by Gavin Rae on Liam Craig, free kick awarded. Callum Davidson takes the free kick.67:51 Goal scored
Goal! - Rowan Vine - St J'stone 2 - 1 Aberdeen Rowan Vine finds the net with a goal from close range high into the middle of the goal. St Johnstone 2-1 Aberdeen.67:22
Corner taken left-footed by Liam Craig,65:53 Substitution
Substitution Scott Vernon goes off and Johnny Hayes comes on.64:01
A cross is delivered by Liam Craig, clearance made by Joe Shaughnessy.62:40 Substitution
Substitution Michael Doughty on for Nigel Hasselbaink.62:21
Clark Robertson produces a left-footed shot from just outside the penalty area that goes harmlessly over the target.61:50
Gavin Rae gives away a free kick for an unfair challenge on Frazer Wright. Callum Davidson takes the direct free kick.61:07
Niall McGinn has an effort at goal from just inside the box that misses to the right of the target.60:54
The ball is delivered by Niall McGinn, Liam Craig makes a clearance.60:31
Free kick awarded for an unfair challenge on Josh Magennis by Rowan Vine. Direct free kick taken by Niall McGinn.59:03
Liam Craig produces a left-footed shot from just outside the penalty box that misses to the left of the goal.58:16
Foul by Isaac Osbourne on Nigel Hasselbaink, free kick awarded. Free kick taken by David MacKay.55:02 Booking
Booking Rowan Vine booked for unsporting behaviour.53:56
Gavin Rae produces a header from inside the area that goes over the bar.52:16
Unfair challenge on Liam Craig by Isaac Osbourne results in a free kick. Direct free kick taken by David McCracken.51:50
Scott Vernon gives away a free kick for an unfair challenge on Liam Craig. Patrick Cregg takes the direct free kick.51:02
Corner from the right by-line taken by Stephen Hughes, Frazer Wright makes a clearance.50:29
Scott Vernon takes a shot. Frazer Wright gets a block in.48:19
The referee blows for offside against Scott Vernon. Free kick taken by Alan Mannus.47:56
Gregory Tade is flagged offside by the assistant referee. Joe Shaughnessy takes the indirect free kick.47:00
Niall McGinn is ruled offside. Alan Mannus restarts play with the free kick.45:01
The referee gets the second half started.45:00 +1:05 Half time
Half Time The match has reached half-time.44:33
Nigel Hasselbaink fouled by Isaac Osbourne, the ref awards a free kick. Callum Davidson restarts play with the free kick.43:42
The assist for the goal came from Josh Magennis.43:42 Goal scored
Goal! - Niall McGinn - St J'stone 1 - 1 Aberdeen Niall McGinn finds the back of the net with a goal from deep inside the penalty box high into the middle of the goal. St Johnstone 1-1 Aberdeen.43:24
Josh Magennis produces a cross,42:38
Foul by Nigel Hasselbaink on Clark Robertson, free kick awarded. Jamie Langfield takes the direct free kick.41:16
The official flags Gregory Tade offside. Joe Shaughnessy restarts play with the free kick.40:48
Joe Shaughnessy fouled by Steven MacLean, the ref awards a free kick. Jamie Langfield takes the direct free kick.39:23
Liam Craig produces a cross, Jamie Langfield makes a comfortable save.38:25
Niall McGinn produces a cross, clearance by Patrick Cregg.34:39
Josh Magennis takes a shot. Callum Davidson gets a block in. Corner taken right-footed by Stephen Hughes from the left by-line, clearance by Frazer Wright.32:39 Goal scored
Goal! - Gregory Tade - St J'stone 1 - 0 Aberdeen A goal is scored by Gregory Tade from inside the penalty area low into the middle of the goal. St Johnstone 1-0 Aberdeen.31:33
Gregory Tade takes a shot. Save made by Jamie Langfield.30:13
Corner taken right-footed by Stephen Hughes, save made by Alan Mannus.29:52
Niall McGinn takes a shot. Frazer Wright gets a block in.28:12
Joe Shaughnessy crosses the ball.23:09
Joe Shaughnessy fouled by Nigel Hasselbaink, the ref awards a free kick. Isaac Osbourne takes the direct free kick.20:54
The ball is swung over by Niall McGinn, save by Alan Mannus.18:15
Liam Craig fouled by Scott Vernon, the ref awards a free kick. Alan Mannus takes the direct free kick.17:07
The referee blows for offside. Jamie Langfield takes the free kick.16:12
Scott Vernon produces a right-footed shot from outside the penalty box and misses wide left of the target.15:44
The ball is delivered by Clark Robertson, clearance by Frazer Wright.13:30
Free kick awarded for an unfair challenge on Stephen Hughes by Steven MacLean. Jamie Langfield takes the direct free kick.12:33
Rory Fallon challenges David MacKay unfairly and gives away a free kick. Free kick taken by David MacKay.10:29
Josh Magennis delivers the ball, save made by Alan Mannus.7:42
The offside flag is raised against Niall McGinn. David McCracken takes the free kick.4:56
Outswinging corner taken left-footed by Liam Craig from the left by-line, Frazer Wright takes a shot. Stephen Hughes makes a clearance.3:17
Niall McGinn takes a shot. David MacKay gets a block in.0:00
The match has kicked off.
Live data and text provided by our data suppliers