St Johnstone battled back to claim a Scottish Cup fifth-round replay against top flight rivals Hearts.
David Templeton beat Peter Enckelman at his near post to give the home side a 10th-minute lead.
St Johnstone captain Dave MacKay was sent off on 74 minutes after picking up two bookings.
However, the visitors managed to find an equaliser when Cillian Sheridan beat the offside trap and tucked home three minutes later.
The two sides will meet again at McDiarmid Park on 14 February.
Hearts were lively from the off and made the breakthrough when Templeton cut in from the left and dispatched a low shot past Enckelman.
Saints probed in search of an equaliser but Francisco Sandaza took a fresh-air swipe at David Robertson's cross.
Templeton almost created a second for his side with a burst into the box but Scott Robinson mis-hit his shot.
Sandaza headed against the crossbar from substitute Sheridan's cross early in the second half.
Hearts then claimed unsuccessfully for a handball against MacKay in the St Johnstone box.
David McCracken headed over and Liam Craig drew a save from Jamie MacDonald as the Hearts goal came under continued pressure.
At the other end, Stephen Elliott could not get enough purchase on his header after meeting Templeton's lofted cross.
St Johnstone's chances suffered a blow when MacKay's high boot connected with Templeton and the defender was punished with a second yellow and subsequent red card.
Moments later, Sandaza got in behind the Hearts defence but his downward volley lacked power and MacDonald gathered.
But Sheridan, who had replaced Robertson, was more successful in front of goal after running on to Sandaza's pass and placing the ball round MacDonald as the keeper came off his line.
A weaving run and shot by Templeton was claimed at the second attempt by Enckelman as the action became frantic in the closing stages.
But there to be no more goals before close of play.
Heart of Midlothian
- 30 MacDonald
- 06 Webster
- 17 McGowan
- 26 Zaliukas
- 02 Hamill Booked
- 08 Black Booked
- 12 Templeton (Driver - 90' )
- 19 Skacel (Taouil - 76' )
- 31 Mrowiec
- 10 Elliott
- 27 Robinson
- 28 Ridgers
- 05 Barr
- 11 Driver
- 21 Taouil
- 23 Glen
- 01 Enckelman
- 02 MacKay Dismissed after an earlier booking
- 03 Davidson
- 06 Anderson
- 18 McCracken
- 04 Morris
- 08 Davidson Booked (Millar - 78' )
- 09 Croft Booked (Keatings - 84' )
- 10 Craig
- 16 Robertson Booked (Sheridan - 45' )
- 21 Sandaza
- 15 Mannus
- 07 Millar
- 11 Sheridan
- 22 Oyenuga
- 46 Keatings
Live Text Commentary
Full Time The final whistle is blown by the referee.90:00 +0:40
Andrew Driver sends in a cross, save by Peter Enckelman.89:05
The free kick is delivered right-footed by Ian Black from right channel.89:05 Substitution
Substitution David Templeton leaves the field to be replaced by Andrew Driver.89:05
James Keatings concedes a free kick for a foul on Mehdi Taouil.88:30
A cross is delivered by David Templeton, save made by Peter Enckelman.86:59
David Templeton takes a shot. Save by Peter Enckelman.85:48
Steven Anderson concedes a free kick for a foul on David Templeton. Ian Black crosses the ball from the free kick right-footed from left channel, Peter Enckelman makes a save.85:01
Outswinging corner taken left-footed by Liam Craig played to the near post.83:12 Substitution
Substitution James Keatings is brought on as a substitute for Lee Croft.83:12
Lee Croft has an effort at goal from just inside the box that misses to the right of the goal.81:20
Francisco Sandaza challenges Mehdi Taouil unfairly and gives away a free kick. Andy Webster restarts play with the free kick.78:31
Foul by Andy Webster on Francisco Sandaza, free kick awarded. Liam Craig takes the direct free kick.77:37 Substitution
Substitution Murray Davidson goes off and Chris Millar comes on.76:57
Callum Davidson provided the assist for the goal.76:57 Goal scored
Goal! - Cillian Sheridan - Hearts 1 - 1 St J'stone Cillian Sheridan finds the net with a goal from deep inside the penalty box to the bottom left corner of the goal. Hearts 1-1 St Johnstone.76:01
Andy Webster takes the direct free kick.76:01 Substitution
Substitution Rudi Skacel leaves the field to be replaced by Mehdi Taouil.76:01 Booking
Booking Booking for Jamie Hamill for dissent.75:30
Lee Croft gives away a free kick for an unfair challenge on Ian Black.
Foul by Stephen Elliott on Murray Davidson, free kick awarded. Free kick taken by Murray Davidson.74:20
Francisco Sandaza has an effort at goal from 18 yards. Jamie MacDonald makes a save.73:17
Direct free kick taken by Marius Zaliukas.73:17 Dismissal
Dismissal The referee red cards David MacKay for second bookable offence.72:51
Unfair challenge on David Templeton by David MacKay results in a free kick.72:19
Unfair challenge on Francisco Sandaza by Ian Black results in a free kick. Liam Craig delivers the ball from the free kick left-footed from left channel, Andy Webster makes a clearance.71:18
David McCracken restarts play with the free kick.71:18 Booking
Booking Booking for Ian Black.71:08
Unfair challenge on Murray Davidson by Ian Black results in a free kick.70:04
The offside flag is raised against Francisco Sandaza. Free kick taken by Jamie MacDonald.69:26
David Templeton sends in a cross.68:31
Free kick awarded for an unfair challenge on Adrian Mrowiec by Cillian Sheridan. Marius Zaliukas takes the direct free kick.67:37
A cross is delivered by David Templeton, Stephen Elliott takes a shot. Save by Peter Enckelman.66:09
Unfair challenge on David MacKay by Rudi Skacel results in a free kick. Peter Enckelman takes the direct free kick.63:29
Direct free kick taken by Marius Zaliukas.63:29 Booking
Booking Lee Croft goes into the referee's book for unsporting behaviour.63:04
Lee Croft concedes a free kick for a foul on Ian Black.62:05
Ian Black gives away a free kick for an unfair challenge on Cillian Sheridan. Free kick crossed left-footed by Liam Craig from left wing.60:31
Marius Zaliukas takes the free kick.60:31 Booking
Booking David MacKay goes into the book for dissent.60:24
Free kick awarded for an unfair challenge on Rudi Skacel by Lee Croft.59:48
Corner taken by Liam Craig from the right by-line played to the near post, clearance by Marius Zaliukas.58:06
Free kick awarded for an unfair challenge on Murray Davidson by Rudi Skacel. Steven Anderson takes the direct free kick.57:00
Unfair challenge on Jamie Hamill by Cillian Sheridan results in a free kick. Andy Webster restarts play with the free kick.54:44
Francisco Sandaza is caught offside. Jamie MacDonald restarts play with the free kick.53:42
Free kick awarded for an unfair challenge on Stephen Elliott by Steven Anderson. Free kick crossed left-footed by Rudi Skacel, clearance by David McCracken.52:58
The referee blows for offside. Indirect free kick taken by Jamie MacDonald.52:21
Stephen Elliott challenges Steven Anderson unfairly and gives away a free kick. Free kick taken by Callum Davidson.51:57
Liam Craig takes a shot. Save by Jamie MacDonald.51:12
A cross is delivered by Liam Craig, Shot from inside the area by Murray Davidson clears the bar.49:17
Unfair challenge on Francisco Sandaza by Ian Black results in a free kick. Callum Davidson crosses the ball in from the free kick, clearance made by Marius Zaliukas.49:07
Jamie Hamill delivers the ball, clearance made by Steven Anderson.47:41
Liam Craig takes a shot. Scott Robinson makes a clearance. Inswinging corner taken from the right by-line by Liam Craig, Close range header by David McCracken goes over the crossbar.47:11
Corner taken left-footed by Liam Craig, clearance made by Ryan McGowan.47:02
The ball is crossed by Lee Croft, clearance made by Marius Zaliukas.46:37
A cross is delivered by Callum Davidson.45:43
Francisco Sandaza takes a shot.45:01
The referee blows his whistle to start the second half.45:00 +1:39 Half time
Half Time The ref blows to end the first period.45:00 +1:01
Ian Black takes a outswinging corner.45:00 Substitution
Substitution David Robertson goes off and Cillian Sheridan comes on.44:36
The ball is crossed by David MacKay, Marius Zaliukas manages to make a clearance.43:01 Booking
Booking Murray Davidson is given a yellow card.42:25
David Templeton crosses the ball, Effort on goal by Scott Robinson from 12 yards. Save made by Peter Enckelman.41:29
Stephen Elliott concedes a free kick for a foul on Murray Davidson. Peter Enckelman restarts play with the free kick.40:01
David Templeton fouled by Francisco Sandaza, the ref awards a free kick. Jamie MacDonald takes the direct free kick.39:29
David MacKay sends in a cross, clearance by Marius Zaliukas.38:58
David Templeton takes a shot. Jody Morris gets a block in.37:05
Unfair challenge on Callum Davidson by Stephen Elliott results in a free kick. Free kick taken by Callum Davidson.35:58
Ian Black gives away a free kick for an unfair challenge on Francisco Sandaza. Free kick crossed left-footed by Liam Craig, Marius Zaliukas manages to make a clearance.31:54
The ball is delivered by Liam Craig, Andy Webster manages to make a clearance.30:43
David Robertson sends in a cross, Effort from inside the area by Francisco Sandaza misses to the left of the goal.29:46
Lee Croft is caught offside. Jamie MacDonald takes the indirect free kick.29:33
The ball is swung over by Ryan McGowan, clearance made by David McCracken.28:54
David Robertson fouled by Adrian Mrowiec, the ref awards a free kick. Direct free kick taken by Steven Anderson.26:54
Unfair challenge on Jamie Hamill by Francisco Sandaza results in a free kick. Direct free kick taken by Jamie MacDonald.26:20
Jody Morris sends in a cross, clearance by Andy Webster.25:34
David Templeton concedes a free kick for a foul on David MacKay. David McCracken takes the direct free kick.22:59
David MacKay crosses the ball, clearance by Andy Webster.18:43
Lee Croft crosses the ball, clearance made by Marius Zaliukas.17:12
Effort from just outside the area by David Templeton goes over the bar.16:37
Marius Zaliukas takes the direct free kick.16:37 Booking
Booking David Robertson booked for unsporting behaviour.16:14
David Templeton fouled by David Robertson, the ref awards a free kick.15:32
Free kick awarded for an unfair challenge on Liam Craig by Stephen Elliott. Free kick taken by Peter Enckelman.13:45
Centre by Scott Robinson, save by Peter Enckelman.13:25
Adrian Mrowiec concedes a free kick for a foul on Jody Morris. Direct free kick taken by Callum Davidson.12:15
Foul by Liam Craig on Rudi Skacel, free kick awarded. Jamie Hamill delivers the ball from the free kick right-footed from right wing, Peter Enckelman makes a save.9:56
The assist for the goal came from Ryan McGowan.9:56 Goal scored
Goal! - David Templeton - Hearts 1 - 0 St J'stone David Templeton scores a goal from the edge of the penalty box to the bottom left corner of the goal. Hearts 1-0 St Johnstone.9:01
Ryan McGowan takes a shot. Save by Peter Enckelman.8:44
Free kick awarded for a foul by David McCracken on Stephen Elliott. Rudi Skacel takes the free kick.8:03
Stephen Elliott is ruled offside. Indirect free kick taken by Peter Enckelman.7:07
Liam Craig gives away a free kick for an unfair challenge on Rudi Skacel. Andy Webster takes the free kick.6:18
Murray Davidson has a volleyed shot. Jamie MacDonald makes a save.5:25
Ian Black takes a weak shot and missed to the right of the goal.3:23
Callum Davidson concedes a free kick for a foul on Rudi Skacel. Free kick taken by Andy Webster.1:20
Corner taken by Liam Craig from the right by-line.1:08
Centre by David MacKay, Marius Zaliukas makes a clearance.0:00
The referee gets the game underway.
Live data and text provided by our data suppliers