Raith Rovers got the better of Hamilton in a five-goal encounter at Stark's Park.
Jason Holt fired home a left-footed effort to give the hosts a ninth-minute lead.
But Hamilton levelled seven minutes later through Dougie Imrie's emphatic strike.
On-loan Hearts player Denis Prychynenko converted John Baird's cross to edge Raith back into the lead on 61 minutes and David Smith's 25-yard effort stretched their advantage.
Hamilton were awarded a penalty when Prychynenko upended Matthew Paterson but James Chambers missed from the spot.
However, Mark McLaughlin did manage to score for the visitors in the closing seconds, the defender netting with an impressive shot.
Raith: McGurn, Murray, Ellis, Hill, Dyer, Allan Walker, Holt (Brian Graham 85), Jamie Walker (Hamill 76), Smith, Prychynenko, Baird. Subs Not Used: Roy, Thomson, Colin Wilson.
Booked: Ellis, Jamie Walker.
Goals: Holt 9, Prychynenko 61, Smith 79.
Hamilton: Hutton, Gordon (Crawford 82), Mensing, McLaughlin, Hendrie, Gillespie (Chambers 68), Millar (Spence 72), McAlister, Imrie, Paterson, Anderson. Subs Not Used: McNeil, McBride.
Booked: Gordon, Millar, McLaughlin, Paterson.
Goals: Imrie 16, McLaughlin 90.
Ref: Stevie O'Reilly