Partick twice came from behind as Lyle Taylor and Gary Fraser cancelled out goals from Callum Paterson and Danny Wilson.
Lee Mair then put the visitors ahead for the first time in the match before Kallum Higginbotham sealed the points.
The win in Edinburgh was enough to see Alan Archibald's side avoid the relegation play-off place ahead of the weekend's final fixtures of season.
Kilmarnock still have work to do with regards securing their top-flight futures, and they face a final-day survival shoot-out with Hibernian after Kris Boyd's first-half winner - his 21st goal of the season - earned them a 1-0 victory over St Mirren.
Killie had lost four games on the bounce - including a five-goal thrashing away to Hearts on Sunday - but now need just a point at Easter Road in three days' time to spare themselves the relegation play-offs.
At the top of the table, Motherwell set up a last-day decider for second place after they hung on for a 2-1 victory over Inverness.
John Sutton sent Motherwell on their way inside four minutes when he netted his 23rd goal of the season after some careless defending from Ross Draper led to him conceding a penalty.
The hosts were given another helping hand in the 31st minute when Inverness defender Gary Warren headed an Iain Vigurs corner into his own net.
Graeme Shinnie pulled one back 10 minutes in when his weak effort beat Lee Hollis but Motherwell held on for the points.
Also on Wednesday, champions Celtic surrendered a two-goal lead with minutes remaining to draw 3-3 with St Johnstone at McDiarmid Park.
Defender Tim Clancy gave the home side the lead in the eighth minute before Saints' top scorer Stevie May had a penalty saved by Hoops stand-in goalkeeper Lukasz Zaluska three minutes from interval after Celtic midfielder Beram Kayal had brought down Michael O'Halloran.
Kris Commons levelled from the spot in the 53rd minute with his 31st goal of the season after fellow substitute Scott Brown had been tripped by Gary McDonald.
Striker Teemu Pukki and defender Virgil van Dijk added further goals which looked to have the champions on easy street but two goals in two minutes, the first from midfielder Scott Brown in the 83rd minute and O'Halloran two minutes later, gave the William Hill Scottish Cup finalists a share of the spoils.