Match ends, Hearts 2, Partick Thistle 4.
Partick Thistle sealed their Premiership safety after producing a stunning second-half comeback to get the better of Hearts.
Callum Paterson opened the scoring for the hosts before Lyle Taylor squared it, but Danny Wilson nodded Hearts back in front before the break.
Gary Fraser levelled with a super strike, Lee Mair headed the Jags in front and Kallum Higginbotham won it.
The victory means Thistle cannot finish in the relegation play-off position.
And that sets up a thrilling showdown between Hibernian and Kilmarnock, who are now the only teams in danger of finishing 11th in the table, at Easter Road on Saturday.
Fresh from their 5-0 demolition job on Kilmarnock on Sunday, Hearts started brightly with the lively Sam Nicholson leading the charge.
The Jags soon found their feet, though, and Higginbotham tested Mark Rigders with a long-range effort, but the stand-in Hearts goalkeeper gathered at the second attempt.
The home side opened the scoring after 16 minutes. Paterson produced a great run in from the right, ghosted past Mair and fired in his 11th goal of the season, despite goalkeeper Paul Gallacher getting a hand to the shot.
It could have been 2-0 seconds later after a delightful move by the hosts.
Kevin McHattie picked out Dale Carrick and his through-ball was perfect for Billy King, but after going one-on-one with Gallacher, he could not keep his shot down.
It was all Hearts for a spell as the Jags struggled to contain the home attack, but the visitors squared it against the run of play just after the half hour.
Higginbotham did the set-up work with a fine pass to send Taylor in on goal and he showed great composure to finish through the legs of Ridgers from 18 yards.
The Jags almost took the lead after 37 minutes, but Taylor's glancing header drifted wide.
Within a minute, the visitors found themselves trailing again.
Hearts won a free-kick on the edge of the area and, from McHattie's delivery, the unmarked Wilson steered a header into the bottom corner.
Taylor thought he had levelled at the start of the second half with a fine volley from Higginbotham's pass, but the offside flag halted Thistle's celebrations.
Only for a few seconds, though, as Gary Fraser did make it 2-2 with a sensational strike that flashed past Ridgers and into the top corner from 25 yards.
James Craigen then passed up a great chance for Thistle after beating the offside trap and Ridgers had to be at his best to keep out a Taylor volley as Thistle piled forward in search of a third.
The goal they craved, and their second-half dominance merited, duly arrived in 68 minutes. A corner was knocked down by Aaron Taylor-Sinclair and Mair headed home.
It was 4-2 a few minutes later when Higginbotham blasted into the net after Ridgers saved Taylor's drive, securing the Jags' place in the Premiership for next season and piling the pressure on Hibs and Killie.
- 12PatersonBooked at 75minsSubstituted forMcKayat 88'minutes
- 19KingSubstituted forWalkerat 67'minutes
- 8RobinsonBooked at 45minsSubstituted forSmithat 67'minutes
- 14ElliottBooked at 90mins
- 8BanniganSubstituted forErskineat 65'minutes
- 21TaylorSubstituted forDoolanat 79'minutes
- 23HigginbothamBooked at 74minsSubstituted forRojo de la Vega Piccoloat 84'minutes
- 13Rojo de la Vega Piccolo
- Crawford Allan
- Shots on Target
Second Half ends, Hearts 2, Partick Thistle 4.
Christie Elliott (Partick Thistle) is shown the yellow card.
Foul by Christie Elliott (Partick Thistle).
Jamie Walker (Hearts) wins a free kick on the left wing.
Attempt saved. Gary Fraser (Partick Thistle) right footed shot from outside the box is saved in the centre of the goal.
Attempt missed. Dale Carrick (Hearts) right footed shot from outside the box is too high.
Substitution, Hearts. Brad McKay replaces Callum Paterson because of an injury.
Gabriel Piccolo (Partick Thistle) wins a free kick on the left wing.
Foul by Dale Carrick (Hearts).
Attempt missed. Aaron Taylor-Sinclair (Partick Thistle) left footed shot from outside the box is too high.
Substitution, Partick Thistle. Gabriel Piccolo replaces Kallum Higginbotham.
Jordan McMillan (Partick Thistle) wins a free kick on the right wing.
Foul by Jamie Walker (Hearts).
Substitution, Partick Thistle. Kris Doolan replaces Lyle Taylor.
Callum Paterson (Hearts) is shown the yellow card.
Foul by Callum Paterson (Hearts).
Aaron Taylor-Sinclair (Partick Thistle) wins a free kick in the defensive half.
Kallum Higginbotham (Partick Thistle) is shown the yellow card.
Goal! Hearts 2, Partick Thistle 4. Kallum Higginbotham (Partick Thistle) right footed shot from the right side of the box to the centre of the goal.