St Mirren clambered off the canvas to stun Hearts and secure a Scottish Cup quarter-final replay in Paisley.
Graham Carey's first-half free-kick from 20 yards put Saints in front as they bossed the opening exchanges.
However, Craig Beattie replied with a header and crossed for substitute Rudi Skacel to put the Edinburgh side ahead on 48 minutes.
St Mirren looked out, but Marius Zaliukas deflected Nigel Hasslebaink's effort into his own net to level.
The Scottish Premier League rivals will do battle again on Wednesday, 21 March for a place in the last four at Hampden Park.
The visitors had a strong claim for a penalty early on when Steven Thompson chased and harried the Hearts defenders to win the ball, before searching out Gary Teale. The veteran's strong effort at goal struck Danny Grainger's hand as he went to block, but referee Stevie O'Reilly waved away the appeals.
Danny Lennon's side had made a whirlwind start and finally made the breakthrough after 27 minutes. Andy Webster fouled Nigel Hasselbaink on the edge of the box after some loose play from Adrian Mrowiec.
St Mirren set-piece specialist Carey needed no second invitation and stepped up to strike a left-footed free-kick through a gap in the Hearts wall and into the net.
The visitors continued to look the livelier side, but Hearts were not a spent force and stunned their opponents with an equaliser after 37 minutes.
Paulo Sergio's side won their first corner of the match and Grainger's pinpoint delivery found Beattie, who guided a header past Craig Samson for his first Hearts goal.
It was now game on, and the Portuguese manager showed his attacking intent by replacing midfielder Mrowiec with St Mirren tormentor-in-chief Skacel, who has a terrific strike record against the Buddies.
Hearts thought they had snatched the advantage in first-half stoppage time when Ian Black's attempted shot found its way to Beattie at the back post, but the former Celtic striker was controversially flagged offside as he squeezed the ball over the line. Television replays suggested he had in fact been onside.
The Tynecastle side did not appear to feel sorry for themselves as they flew out the traps for the second half.
Stephen Elliott's drive from 16 yards stung the palms of Samson and Ryan McGowan forced the St Mirren keeper to parry with his effort on the rebound. The ball found Elliott once again, but he squandered a clear opportunity when he fired wide of the post.
Lennon's side failed to heed the warning signs and paid the price. Beattie found substitute Skacel's head with a cross from the left to beat Samson and seize the advantage.
Hearts were a team transformed and Skacel could have made it 3-1, however he took a touch too many in the penalty area and defender David van Zanten intervened before he could pull the trigger.
They were to rue that missed opportunity as St Mirren conjured up an unlikely leveller and a replay with six minutes remaining.
Hasselbaink and Teale brought out great saves from Jamie MacDonald before the striker sclaffed the ball across goal and Zaliukas' heel diverted the ball past his own goalkeeper.
Heart of Midlothian
- 30 MacDonald
- 03 Grainger
- 06 Webster
- 17 McGowan
- 26 Zaliukas
- 08 Black
- 11 Driver
- 21 Taouil
- 31 Mrowiec (Skacel - 38' )
- 04 Beattie
- 10 Elliott
- 28 Ridgers
- 05 Barr
- 19 Skacel
- 23 Glen
- 38 Morton
- 01 Samson
- 02 van Zanten
- 05 Mair
- 06 Goodwin
- 08 Thomson
- 17 Mclean (Murray - 57' )
- 21 Teale
- 23 Carey
- 09 Thompson
- 10 McGowan Booked
- 11 Hasselbaink
- 12 Smith
- 03 Barron
- 14 McAusland
- 07 Murray
- 15 Mooy
Live Text Commentary
Full Time The referee signals the end of the game.90:00 +0:26
Gary Teale is caught offside. Jamie MacDonald restarts play with the free kick.88:19 Booking
Booking Paul McGowan receives a yellow card.86:46
The official flags Craig Beattie offside. Craig Samson takes the free kick.83:35
The assist for the goal came from Nigel Hasselbaink.83:35 Goal scored
Goal! - Marius Zaliukas - Hearts 2 - 2 St Mirren An unfortunate own goal is conceded by Marius Zaliukas. Hearts 2-2 St Mirren.82:21
Inswinging corner taken from the right by-line by Graham Carey.81:16
Craig Beattie fouled by Lee Mair, the ref awards a free kick. Andy Webster takes the direct free kick.77:56
Craig Beattie fouled by Hugh Murray, the ref awards a free kick. Andy Webster takes the direct free kick.76:12
Paul McGowan is flagged offside by the assistant referee. Jamie MacDonald takes the free kick.75:01
Mehdi Taouil fouled by Paul McGowan, the ref awards a free kick. Ian Black restarts play with the free kick.73:40
Effort from outside the box by Gary Teale goes wide right of the target.72:45
Unfair challenge on Nigel Hasselbaink by Daniel Grainger results in a free kick. Free kick taken by Jim Goodwin.70:35
Header from deep inside the area by Andy Webster goes harmlessly over the crossbar.70:02
Graham Carey gives away a free kick for an unfair challenge on Stephen Elliott. Ian Black takes the direct free kick.66:43
Andrew Driver takes a long range shot clearing the bar.65:09
Effort on goal by Nigel Hasselbaink from inside the area goes harmlessly over the bar.63:49
The assistant referee flags for offside against Craig Beattie. Free kick taken by Lee Mair.63:14
The referee blows for offside. Marius Zaliukas takes the free kick.62:32
Craig Beattie produces a right-footed shot from inside the area that clears the crossbar.
Free kick awarded for an unfair challenge on David van Zanten by Craig Beattie. Free kick taken by Craig Samson.57:25
Stephen Elliott takes a shot. Jim Goodwin gets a block in.56:29 Substitution
Substitution (St Mirren) makes a substitution, with Hugh Murray coming on for Kenny McLean.53:02
Foul by Craig Beattie on Jim Goodwin, free kick awarded. Free kick taken by Craig Samson.52:22
Corner taken by Ian Black from the left by-line, clearance made by Steven Thompson.49:29
Free kick awarded for an unfair challenge on Marius Zaliukas by Steven Thompson. Marius Zaliukas restarts play with the free kick.47:44
Assist on the goal came from Craig Beattie.47:44 Goal scored
Goal! - Rudi Skacel - Hearts 2 - 1 St Mirren Rudi Skacel finds the back of the net with a headed goal from close range. Hearts 2-1 St Mirren.46:03
Ryan McGowan takes a shot. Save made by Craig Samson. Effort from deep inside the area by Stephen Elliott misses to the left of the goal.45:39
Stephen Elliott takes a shot. Craig Samson makes a save.45:12
Free kick awarded for a foul by Gary Teale on Ian Black. Direct free kick taken by Jamie MacDonald.45:01
The match restarts for the second half.45:00 +1:11 Half time
Half Time The players leave the pitch at half time.45:00 +0:58
The official flags Craig Beattie offside.44:25
Free kick awarded for a foul by Nigel Hasselbaink on Ian Black. Andy Webster takes the direct free kick.41:42
Stephen Elliott produces a right-footed shot from just outside the box that misses to the right of the net.37:44 Substitution
Substitution Rudi Skacel replaces Adrian Mrowiec.36:48
Daniel Grainger provided the assist for the goal.36:48 Goal scored
Goal! - Craig Beattie - Hearts 1 - 1 St Mirren Craig Beattie grabs a headed goal from close range. Hearts 1-1 St Mirren.36:20
Corner taken by Daniel Grainger from the right by-line,35:26
The assistant referee signals for offside against Nigel Hasselbaink. Free kick taken by Andy Webster.35:04
Paul McGowan takes a shot. Mehdi Taouil gets a block in.33:29
Free kick awarded for a foul by Ian Black on David van Zanten. Jim Goodwin takes the free kick.31:04
Free kick awarded for an unfair challenge on Ian Black by Paul McGowan. Ian Black takes the free kick.29:14
Outswinging corner taken from the right by-line by Graham Carey, Headed effort from deep inside the area by Lee Mair misses to the right of the goal.28:54
Kenny McLean takes a shot. Ian Black gets a block in.27:21
Gary Teale takes a outswinging corner from the right by-line played to the near post, save by Jamie MacDonald.26:01
The assist for the goal came from Nigel Hasselbaink.26:01 Goal scored
Goal! - Graham Carey - Hearts 0 - 1 St Mirren Free kick scored by Graham Carey from outside the penalty area to the bottom right corner of the goal. Hearts 0-1 St Mirren.24:59
Free kick awarded for an unfair challenge on Nigel Hasselbaink by Andy Webster.23:58
Nigel Hasselbaink is flagged offside by the assistant referee. Jamie MacDonald restarts play with the free kick.21:36
Foul by Andy Webster on Steven Thompson, free kick awarded. Graham Carey shoots direct from the free kick.20:59
Craig Beattie is flagged offside by the assistant referee. Jim Goodwin takes the indirect free kick.19:36
Shot from just outside the box by Paul McGowan misses to the right of the goal.19:18
Andrew Driver takes a shot. Save by Craig Samson.17:14
The referee blows for offside against Steven Thompson. Jamie MacDonald restarts play with the free kick.14:51
Headed effort from deep inside the area by Craig Beattie misses to the left of the goal.12:02
Unfair challenge on Gary Teale by Daniel Grainger results in a free kick. Free kick taken by David van Zanten.10:33
Nigel Hasselbaink takes a shot. Blocked by Mehdi Taouil. Graham Carey takes the outswinging corner, Steven Thompson has a headed effort at goal from deep inside the area missing to the right of the target.8:59
Shot by Paul McGowan from deep inside the penalty area misses to the right of the goal.6:33
Paul McGowan takes a shot. Blocked by Adrian Mrowiec.5:18
Steven Thompson takes a shot. Save made by Jamie MacDonald.4:09
Adrian Mrowiec concedes a free kick for a foul on Graham Carey. Craig Samson takes the free kick.3:15
Free kick awarded for a foul by Steven Thompson on Daniel Grainger. Free kick taken by Jamie MacDonald.2:10
Unfair challenge on Kenny McLean by Adrian Mrowiec results in a free kick. Direct free kick taken by Lee Mair.0:00
The match begins.
Live data and text provided by our data suppliers