Substitute Anderson opened the scoring at McDiarmid Park
Steven Anderson helped put his former team Dundee United to the sword as St Johnstone squeezed through to the Co-operative Insurance Cup semi-finals.
Making only his fifth appearance of the season, the defender headed his team in front on 72 minutes.
Moments later visiting player Darren Dods scored an own goal from Liam Craig's free-kick.
United's Prince Buaben set up a frantic finish after looping a header in over Graeme Smith on 81 minutes.
There was a surprise name on team sheet for St Johnstone, when former Rangers and Hibernian forward Jonatan Johannson was included after signing as a free agent for the Perth club.
The Finn, and strike partner Kenny Deuchar both missed good chances to open the scoring inside 10 minutes as the Saints enjoyed the bulk of possession.
United worked their way into the game but only Danny Cadermarteri managed to test goalkeeper Smith in the opening period with a shot on 20 minutes, while David Goodwillie went just wide with a long range drive.
The home side could have gone ahead on the half-hour mark, but Johansson and Murray Davidson got in each other's way trying to head home Liam Craig's cross.
Chris Millar also mis-hit a first-time effort straight at United goalkeeper Steve Banks from Deuchar's knockdown, before he himself shot over the bar from the edge of the box.
Into the second half and Anderson opened the scoring from a fine corner delivered by Craig.
And Craig was involved again on 74 minutes as Saints doubled their lead - his delivery from a free-kick causing trouble in the United defence and flicking off Dods past his own goalkeeper.
With nine minutes to go Buaben ensured a nervy finish, with a header high over Smith, but the Scottish Premier League newcomers held on to dump last season's beaten finalists.
St Johnstone manager Derek McInnes: "I'm very pleased it was hugely competitive as you would expect from a derby game with a lot at stake.
"We had a number of injuries but credit to the ones who came in as there wasn't a single failure tonight.
"I thought we started better and forced them back and to a man I was delighted with the performance.
"We're one step closer to another cup final and that's something to look forward to."
Dundee United manager Craig Levein: "We didn't play well enough to win the match or show that there was a gap in quality.
"So I think St Johnstone deserved to win, all credit to them - although I think we scored both their goals.
"But they put the balls into dangerous areas to get the goals and I'm more disappointed that we gave away the free-kicks where we did."
This page is best viewed in an up-to-date web browser with style sheets (CSS) enabled. While you will be able to view the content of this page in your current browser, you will not be able to get the full visual experience. Please consider upgrading your browser software or enabling style sheets (CSS) if you are able to do so.