Robbie Muirhead had given the hosts an early lead but despite a bright start, Killie failed to build on their lead.
That proved costly as they then twice allowed themselves to be breached from dangerous corner deliveries in the final 15 minutes of the first period.
The win was perfect preparation for Saints ahead of next weekend's William Hill Scottish Cup semi-final against Aberdeen, but leaves Allan Johnstone's side now perched just three points above 11th-placed Partick Thistle and the relegation play-off slot.
There was just four minutes played when Muirhead put his side in front.
The goal came after Saints keeper Alan Mannus thought he had done enough to divert Kris Boyd after the Scotland striker spun and fired off a shot from just inside the box. But Mannus' parry dropped loose in the six-yard box and Killie's talented 18-year-old Muirhead reacted quicker than Perth defender Dave Mackay to poke it home.
Alexei Eremenko could have added a second just before the quarter hour but the Finn's dipping 25-yard volley came down a fraction too late as it landed on the net's roofing.
The boggy Rugby Park surface was not making life easy for either side but Kilmarnock did their best to link up with some clever exchanges.
St Johnstone nearly levelled though midway through the half as Lee Croft's out-swinging corner was met by David Wootherspoon at the near post but Muirhead again proved vital for his team as he headed off the line.
Kilmarnock failed to learn their lesson and allowed another Croft delivery to be their undoing. The former Oldham winger pulled the corner back to the angle of the six-yard box where it was met by Wright, who bulleted his header into the roof of Craig Samson's net.
The goal had halted the home side's momentum and they conceded again as Saints made this most of their frailty defending the near post from set-pieces two minutes before the break.
This time it was a corner from Wotherspoon on the opposite side which was aimed for the unchecked Anderson and he made Killie pay as he fired the ball under Samson to give his side the lead.
The visitors failed to start the second half with the same energy they showed at the close of the first but with Eremenko, looking more than a few pounds over his prime fighting weight, partnering defender-cum-midfielder in the middle of the park, Killie lacked pace in the vital areas.
It was little surprised when Eremenko, breathing heavier and heavier, was hooked with 20 minutes left to be replaced by Michael Gardyne, taking out his frustrations on an advertising as he marched straight up the tunnel.
The former Metalist Kharkiv playmaker is a mile short of full fitness and offered little to his team by way of skill on the ball or graft.
Stevie May was then denied the chance to beat Paul Wright's post-war league goals record for the Perth side as the 18-goal striker was replaced by Michael O'Halloran.
Craig Slater did well to work an opening with eight minutes left but sliced his shot badly wide as Killie began to look increasingly desperate, while Samson saved well with his legs to stop Wotherspoon extending the visitors' lead with a low drive.