Joe Cardle netted twice as Raith beat Alloa in a thrilling encounter at Stark's Park.
The visitors drew first blood in the 16th minute when Kevin Cawley drilled the ball into the bottom corner of David McGurn's goal from 12 yards.
Raith equalised in the 28th minute when Cardle's cross went straight into the net after Calum Elliot had fooled goalkeeper Scott Bain with a dummy.
Rovers went ahead three minutes after the break; Grant Anderson lashing the ball past Bain from a tight angle.
Ryan McCord's penalty drew the Wasps level after Grant Anderson had fouled Daryll Meggatt in the box.
Elliot put the hosts back in front when he headed in Cardle's cross in the 79th minute, before Cardle himself added a fourth in stoppage time.
Raith: McGurn, Thomson, Paul Watson, Hill, Booth, Anderson (Vaughan 81), Moon (Callachan 74), Fox, Cardle, Spence (Smith 90), Elliot. Subs Not Used: Roberts, Donaldson, Matthews, Bates.
Goals: Cardle 28, Anderson 48, Elliot 79, Cardle 90.
Alloa: Bain, Michael Doyle, Gordon, Marr, Tiffoney (McManus 63), Holmes, Simmons, McCord, Meggatt, Cawley, Kirk (Salmon 78). Subs Not Used: McLelland, Moore, Young, McDowall.
Booked: Gordon, Simmons, Cawley.
Goals: Cawley 16, McCord 62 pen.
Ref: Calum Murray