Brian Graham netted a last-minute winner as Raith Rovers ended a run of three straight defeats by beating Dumbarton.
Allan Walker steered the ball home to give Rovers a 39th-minute lead but Bryan Prunty levelled before the break with a shot in off the post.
Prunty equalised again with a half-volley after Patrick Clarke had swept the ball in for Raith's second.
But the hosts did find a winning lead when Graham slammed home from inside the area near the end.
Raith: McGurn, Thomson, Mensing, Ellis, Malone, Grant Anderson (Smith 54), Stuart Anderson, Walker, Hamill (Spence 67), Graham, Clarke. Subs Not Used: Laidlaw, Callachan, Donaldson.
Booked: Stuart Anderson, Ellis.
Goals: Walker 39, Clarke 52, Graham 90.
Dumbarton: Grindlay, McGinn, Lithgow, Urquhart, Smith, Fleming (Ronald 77), Phinn (McCusker 89), Agnew, Lamont (McDougall 54), Lister, Prunty. Subs Not Used: Lumsden, Creaney.
Booked: Prunty, Smith, McGinn.
Goals: Prunty 45, 58.
Ref: Craig Charleston