Anderson, who was released by United 10 years ago and is in his testimonial year, headed home at the far post in the dying seconds of the first-half, before MacLean capitalised on a lucky deflection on 84 minutes to ensure there would be no third Scottish Cup success for United, who twice hit the frame of the goal in a high-tempo encounter.
Anderson’s goal – after keeper Radoslaw Cierzniak misjudged the flight of David Wotherspoon’s corner – was cruel on United, who had finally settled after a difficult opening 30 minutes.
After an early scare, in which keeper Alan Mannus spilled Ryan Dow’s cross, St Johnstone settled well and carved out the game’s first chance as Chris Millar fed Brian Easton down the left and his cross eventually fell to James Dunne, whose improvised volley from 20 yards was tipped over by Cierzniak.
Frazer Wright then failed to make decent contact at the near post from the resulting corner, but Saints continued to probe and should have gone ahead on 21 minutes when Stevie May’s free-kick struck the wall and fell kindly to Wotherspoon in the box.
Wotherspoon did well to cut inside and fashion a shooting chance, but his shot, which was bending inside the far post, was blocked brilliantly by Gavin Gunning, who deserved the fortune of seeing the ball rebound back to his keeper.
Dow’s energy and delivery was the sole bright spark for United early on as they struggled to maintain possession and build pressure, with Gary Mackay-Steven and Stuart Armstrong both dragging speculative shots wide from the edge of the box.
But they grew stronger as the half wore on and were inches from taking the lead on 37 minutes – Dow’s exquisite touch from Andrew Robertson’s cross hitting the inside of the post before being shanked to safety. Keith Watson headed the subsequent corner over from eight yards.
Anderson then struck in the only minute of first-half injury time before United striker Nadir Ciftci’s free-kick hit the underside of the bar and somehow failed to bounce over the line after falling behind a sprawling Mannus.
Back came Saints, and May looked to have headed them further ahead on 52 minutes only to see his effort ruled out following some fine officiating.
May’s header was saved on the line, prompting the St Johnstone strike to punch the ball into the net. Referee Craig Thomson initially awarded a goal, believing the header had crossed the line before being saved, but after advice from his assistant, May was rightly booked for handball with replays showing Cierzniak had made a superb save.
Still, the game opened up as United pushed forward, allowing Wotherspoon to weave a wonderful run on the break, but his shot didn’t match the skill and Cierzniak’s save was an easy one, with Robertson’s immediate reply being a curled effort from 20 yards that Mannus tipped around the post at full stretch.
The impressive Ciftci then stormed forward and shot inches wide only for United’s spirit to be broken when MacLean raced onto a loose ball and prodded past Cierzniak at the second attempt, allowing Saints to see the game out, lift the trophy in their first final and look forward to a Europa League qualifier in July.