Cowdenbeath came from behind to beat Raith in a derby game that only really came to life in the last 20 minutes.
Paul McManus' great footwork provided him the space to fire Raith into the lead on 71 minutes.
But the visitors were level two minutes later when Liam Buchanan's shot from the edge of the box beat Chris Fahey.
The winner came seven minutes from time when Buchanan and Pat Clarke carved open the home defence to leave Markus Paatelainen with a simple tap-in.
Raith: Fahey, Wilson, Pelofi, Campbell, Lumsden, Silvestro, Fairbairn, One, McManus, Harty (A Trialist 61), Ian Davidson (Tulloch 46).
Subs Not Used: Andrews, Manson, Currie.
Goals: McManus 71.
Cowdenbeath: Hay, Baxter, Hill, Lennon (Fotheringham 11), Ritchie, Hannah, Paatelainen, Patrick Scullion (Fusco 81), Buchanan, Weir (Clarke 57), Ellis.
Subs Not Used: Dalziel, Allison.
Goals: Buchanan 73, Paatelainen 83.
Ref: David Somers (Scotland).