The game looked set to end in a hard-fought stalemate until Racchi superbly chipped visiting goalkeeper Craig Samson to earn the hosts all three points.
It was a thrilling way to end a second half that had struggled to live up to the opening 45 minutes.
Lee Mair gave St Mirren the lead after 10 minutes but his goal was cancelled out by Paul Heffernan 10 minutes before the break.
St Mirren made the brighter start and Kilmarnock goalkeeper Cammy Bell was forced into a good stop after only two minutes from Steven Thompson’s long-range drive.
The home side’s first chance fell to Heffernan who latched on to Alex Pursehouse’s intelligent through-ball but
Samson made a brave stop at the striker’s feet.
Marc McAusland came agonisingly close to giving the visitors the lead after eight minutes when he struck the bar after connecting with Graham Carey’s corner.
It was not long before Saints did grab the lead however, as Carey’s corner just a minute later was headed home by Mair despite the best efforts of Bell to keep the ball out.
After falling behind Killie appeared to be struggling to find any way through the visitors’ defence and the home fans vented their frustration at an increasingly error-ridden display from their team.
Kilmarnock boss Kenny Shiels reacted to this and after 30 minutes he replaced Pursehouse with Zdenek Kroca in an attempt to help his side force an equaliser.
The change seemed to galvanise Kilmarnock, firstly Dean Shiels forced Samson to turn his shot past the post and from the resulting corner Heffernan spun and struck a low shot into the bottom left corner.
The hosts had the first chance of the second half when a well-worked free-kick was struck over by Matthew Kennedy.
St Mirren created a chance of their own in the 48th minute when Paul McGowan seized on an error in the Killie defence, the striker laid the ball to Aaron Mooy but the 21-year-old failed to test Samson.
With the game very much in the balance, St Mirren boss Danny Lennon brought on Nigel Hasselbaink and Steven Thomson to replace Mooy and Carey.
Saints were presented with a good opportunity to take the lead when Liam Kelly felled Hasselbaink at the edge of the box in the 68th minute. The striker took the free-kick himself but blazed well over.
Hasselbaink had another good chance 11 minutes later but failed to connect with Thompson’s dangerous delivery.
Lennon made his final change of the afternoon when the tireless Thompson was replaced by Gary Teale.
St Mirren appeared to be finishing the match the stronger side with Teale causing problems with his direct style of play, but it was Kilmarnock who were to grab the winner with just one minute remaining as Racchi’s sublime chip over the head of Samson from just outside of the box proved decisive.