Brad McKay knocked in the decisive penalty in a Scottish League Cup penalty shoot-out as Hearts edged out 10-man Raith Rovers.
Liam Fox shot the Championship side in front on 50 minutes but Jamie Hamill levelled with a penalty soon after.
Dougie Hill was sent off after a clash with Hamill and neither side could find a winner in extra-time.
And the Stark's Park side paid the price for missing four of their eight attempts from 12 yards.
The win keeps Hearts' spirits high after a promising start to their Premiership campaign, which has seen the administration-hit side reduce their 15-point deficit to minus eight after just four games.
Hearts midfielder Jason Holt registered the first shot on target after six minutes when his low drive from 25 yards forced David McGurn into a smart save.
Jamie MacDonald got down well to stop a Joe Cardle effort at the near post after 22 minutes but it proved to be the Hearts goalkeeper's last piece of action.
The shot-stopper limped off moments later and was replaced by Mark Ridgers, who was to be a hero in the shoot-out.
The substitute keeper was called into action moments before the break to make a diving save to palm away a rising Calum Elliot drive from 30 yards.
Rovers made a positive start after the interval and went ahead through former Hearts midfielder Fox.
A dangerous Elliot run into the box caused panic and Ridgers produced a great save to block a Gordon Smith shot from close range but Fox found a gap in a congested box to fire into the net.
Hearts equalised from the penalty spot in the 62nd minute after Jason Thomson had brought down Billy King inside the area.
Hamill stepped up and sent McGurn the wrong way from 12 yards with a low shot.
The Hearts midfielder was involved again as Rovers were reduced to 10 men in the 74th minute after Hill was shown a straight red card for going head-to-head with Hamill.
Extra-time came and went without either team managing to break the deadlock as the Fife side battled well to contain the visitors from Edinburgh.
Hearts twice wasted the chance to settle the tie on penalties when Kevin McHattie and Holt failed to convert but McKay finally won it in sudden death after Ross Callachan's miss for Raith.
- 01 McGurn
- 02 Thomson Booked
- 03 Booth
- 04 Watson Booked
- 05 Hill Dismissed
- 06 Fox
- 07 Cardle
- 08 Moon (Callachan - 99' )
- 11 Anderson (Vaughan - 85' )
- 10 Elliot Booked
- 15 Smith (Ellis - 75' )
- 20 Roberts
- 14 Donaldson
- 16 Ellis
- 12 Callachan
- 21 Vaughan
Heart of Midlothian
- 01 MacDonald (Ridgers - 25' )
- 03 McHattie Booked
- 04 Wilson Booked
- 05 McGowan
- 16 McKay
- 02 Hamill Booked
- 14 Walker
- 15 Holt
- 19 B King (Smith - 77' )
- 08 Robinson (Oliver - 55' )
- 12 Paterson
- 13 Ridgers
- 30 McGhee
- 17 Smith
- 20 Tapping
- 29 Oliver