Brian Graham netted a last-minute winner as Raith ended a run of three consecutive defeats by edging a five-goal thriller against Dumbarton.
Allan Walker's first goal since October gave Rovers a 39th-minute lead, the midfielder steering the ball into the bottom corner from inside the area after being found by Patrick Clarke.
Dumbarton levelled in first-half stoppage time as Bryan Prunty fired in off the post from 12 yards.
Seven minutes after the break Patrick Clarke put Raith back into the lead as he swept the ball in from the edge of the area.
But Prunty soon had the Sons on level terms once again as he half-volleyed in from close range from Alan Lithgow's knockdown.
Rovers won the points as the game entered added time as Graham slammed home from inside the area for his 21st goal of the season.