Hearts progressed to the Betfred Cup knockout rounds despite being held to a draw and losing the subsequent penalty shootout at League One East Fife.
The Edinburgh club missed out on a seeding berth for the last-16 draw as a result.
Jamie Walker's first goal since rejoining Hearts last month saw the visitors 1-0 ahead at the interval. Chris Duggan's equaliser shortly after the break punished them for failing to capitalise on a plethora of scoring opportunities.
The penalty shootout at the end of 90 minutes went to sudden death. After Aaron Hickey's penalty was saved by East Fife goalkeeper Brett Long, Aaron Dunsmore converted to secure a bonus point for the Fifers with a 7-6 victory. The draw was sufficient for Hearts to win Group A with nine points. Since that total is not among the top four section winners, they will not be seeded in Sunday's draw for the next round.
Craig Halkett, Hearts' midweek two-goal hero, retained his starting place despite manager Craig Levein making five team changes. The away side knew a win would guarantee progress and made a confident start. Several shots were fired at the East Fife goal in the opening minutes, which were blocked or saved by Long.
Halkett didn't take long to make an impact once again. On 15 minutes, he won a 50/50 tackle and sprinted to keep the resultant loose ball in play near the right touchline. The defender then delivered a low cross towards the back post, where Walker arrived to convert the opening goal from close range.
Long's acrobatic save prevented Uche Ikpeazu heading a second goal from Andy Irving's corner ten minutes later. Ikpeazu then prodded an attempt into the side netting from an acute angle. Jake Mulraney's pace and direct running were also causing problems for the dominant hosts.
The torrential downpours affecting Scotland's central belt missed the cloudy East Neuk of Fife, but plenty troublesome balls rained down on Long and his defence. A hooked effort from forward Duggan was pushed for a corner by Hearts goalkeeper Zdenek Zlamal in a rare East Fife attack before the interval.
Walker's low cross somehow evaded both Ikpeazu and Dario Zanatta early in the second period. Hearts were pressing for more goals but at 1-0 East Fife retained justifiable hope of taking something from this tie. Their equaliser arrived on 53 minutes.
Ryan Wallace's cross from the right bounced across goal for Duggan to touch a looping finish over Zlamal into the net. As black and gold shirts charged around in celebration, nerves within the away camp quickly multiplied.
The jitters became evident any time the Fifers delivered a ball into Zlamal's penalty box. Hearts required composure and found it before going back on the offensive. Ikpeazu teed up Michael Smith for an 18-yard volley which bounced narrowly wide.
Aidan Keena and later Steven MacLean entered the fray as substitutes but East Fife defended manfully in the final stages. Another Hearts replacement, Oliver Bozanic, had a curling 25-yard free-kick pushed away for a corner by Long's left fist.
Mulraney created one more chance in the final minute of regulation time. His low cross from the right flank landed with MacLean almost on the goal line at the near post. The striker's scuffed shot rolled across the line and eventually out of play.
The final whistle signalled a shootout, which went to sudden death. Smith, MacLean, Keena, Walker and Mulraney all scored for Hearts but Sean Clare and Bozanic failed to convert. Scott Agnew, Wallace, Anton Dowds, Stewart Murdoch, Ross Davidson, and Chris Higgins converted for East Fife. Duggan and Pat Slattery missed to leave the shootout poised at 6-6.
The teenage Hickey was desperately disappointed as Long saved his kick. That allowed Dunsmore - who was released by Hearts aged 16 in 2012 and joined rivals Hibs - to win the shootout 7-6.
East Fife (4-4-2): Long; Murdoch, Dunlop, Higgins, Slattery; Dunsmore, Hunter (R Davidson 61), Agnew, Watt (Dowds 78); Wallace, Duggan. Unused subs: Hart, Watson, A Davidson, Laird, Lamont.
Hearts (4-4-1-1): Zlamal; M Smith, Halkett, Berra, Hickey; Zanatta (Keena 61), Clare, Irving (Bozanic 67), Mulraney; Walker; Ikpeazu (MacLean 79). Unused subs: Doyle, Cochrane, Dikamona, C Smith.
Referee: David Munro.