Allan Walker's strike completed Raith Rovers comeback as they came from behind to beat Hamilton and ease their relegation worries.
Hamilton should have gone ahead early, but Mark McLaughlin somehow planted his header wide from six yards after a great Daniel Redmond cross.
McLaughlin made amends after 23 minutes, rising to meet a Redmond free-kick with a thumping header that gave Rovers goalkeeper David McGurn no chance.
The home side hit back 10 minutes after the break, Damian Casalinuovo drilling an effort into the bottom left corner from the edge of the area.
The Fifers completed the turnaround in the 61st minute thanks to Walker, who provided the finishing touch to an inviting cross from substitute Jamie Walker.
Hamilton's best chance to equalise fell to Grant Gillespie but he blasted his volley over as the home side held on to claim a vital three points.
Raith Rovers: McGurn, Jason Thomson, Davidson, Hill, Ellis, Dyer, Murray, Allan Walker (Williamson 89), Hamill (Jamie Walker 48), Baird, Casalinuovo (Clarke 86). Subs Not Used: Laidlaw, Brian Graham. B
Booked: Ellis, Davidson, Jason Thomson. Goals: Casalinuovo 55, Allan Walker 61.
Hamilton: Hutton, McLaughlin (Gillespie 66), Mensing, Canning, Hendrie, Routledge, Redmond (Stewart 83), Neil, McAlister, Andy Ryan, McShane (Longridge 80). Subs Not Used: Blair Currie, MacGregor.
Booked: McAlister. Goals: McLaughlin 23.
Ref: Craig Charleston