The game looked beyond the Fifers after Joao Vitoria and Dale Carrick gave the home men a two goal lead half an hour in.
Liam Buchanan got one back for the visitors but when Vitoria added his second with only seven minutes left it looked like game over, particularly as Raith were down to ten men after Iain Davidson had been sent off for a headbutt.
A remarkable sequence of events was to come though.
Firstly, Buchanan added a second with three minutes remaining. Kevin Nesbitt then equalised from a free-kick in the 91st minute before Buchanan completed his hat-trick.
Another remarkable comeback took place at Glebe Park as Brechin came from two down to snatch a 93rd minute winner courtesy of Boris Melingui.
Bobby Barr and a Dumbarton triallist had the visitors in a comfortable lead with 55 minutes gone but the home men were not to be denied, Melingui pulling one back on the hour with a cracking free-kick before a Callum Tapping effort pulled them level.
Melingui would then be the hero as he popped up in the six-yard box to steal the victory.
Arbroath remain top after running out comfortable 3-0 victors away to East Fife.
A five-minute double salvo just before half-time put the visitors in control.
The first goal came from Thomas O’Brien before Ryan Wallace finished well to double the lead. Danny Denholm put the game to bed with 15 minutes remaining.
Forfar Athletic put their midweek Challenge Cup disappointment to the side to beat Stenhousemuir 2-0 at Station Park.
Veteran John Baird opened the scoring on the half-hour mark and Murray MacKintosh doubled the lead six minutes later.
Elsewhere, Stranraer continued their solid start to the season with a 2-0 win over Montrose. David Brownlie and Grant Anderson got the goals inside 18 minutes.