It was a hard-fought (and barely merited) victory for the hosts, who had to endure a penalty decider. Goalkeeper Remi Matthews, on loan from Norwich City, was the hero, saving from Rhys McCabe, Michael Paton and Gavin Reilly.
Massimo Donati and Eamonn Brophy converted, before Mikey Devlin clinched the victory for Martin Canning’s side, who could afford the luxury of a miss by Danny Redmond.
Hamilton struggled to impose themselves in this tie, being outmuscled all too often for the liking of a disenchanted home support.
Goalkeeper Sean Murdoch was a spectator for most of the opening 45 minutes, the best openings being manufactured by the Championship side.
Remi Matthews had already saved at full stretch from Michael Moffat when dilatory defending at a set-piece allowed the visitors to take the lead.
Celtic loanee Paul McMullan’s inswinging corner was met by Lee Ashcroft, whose first header – an attempt at scoring – was blocked. However, he then directed his header across goal for Callum Morris and the former Dundee United defender reacted first to force the ball home from close range.
Nicky Clark slashed a shot wide when he should have done better and Hamilton were furious when referee Craig Thomson decided, quite correctly, that Morris had not taken the legs from Redmond.
However, there should have been no room for doubt when Grant Gillespie picked Dougie Imrie out with a cross to the far post but, just six yards out, the veteran mistimed his volley and failed to hit the target as the first half drew to a close.
Dunfermline continued to look the likelier side when play resumed, although Rakish Bingham stung Murdoch’s fingers with a fierce snapshot from 30 yards in the 52nd minute.
However, if that attempt came from out of the blue, the Pars almost scored again eight minutes later from a well-worked move.
Clark’s cutback found Moffat in space and, while Matthews deserves credit for leaving his line to block his shot, John Herron’s lob from the loose ball could just as easily have landed in his net as opposed to on top of it.
That one phase of passing, however, contained more invention than the team from the top tier had displayed up until then.
With time running out, Hamilton threw more and more players forward in search of an equaliser and twice more appealed in vain for a penalty, once when Scott McMann went to ground under pressure from Kallum Higginbotham and again when Mr Thomson decided that Ashcroft had not deliberately handled a netbound shot from Devlin.
However, the official relented at the fourth time of asking, pointing to the spot when Morris lunged at McMann and Bingham converted emphatically to take the tie into extra time.