Dunfermline Athletic leapfrogged Hamilton Academical at the bottom end of the Scottish Championship with a 3-2 victory at East End Park.
All five goals came in the second half. Matthew Todd opened the scoring for the hosts before Sean McGinty levelled with 20 minutes to play.
A Josh Cooper double inside five minutes put Dunfermline comfortably ahead and, although Oli Shaw pulled one back with a stoppage-time penalty, it was only a consolation.
Dunfermline move up to sixth, with Hamilton in seventh, but both are on 15 points along with Raith and Morton in eighth and ninth places.