The hosts had an early scare with Lewis Smith finding space and firing just wide of the post within a minute of kick-off.
Brad Spencer took a sore one and the game was temporarily delayed before Raith won a penalty after Jamie Hamilton was judged to have handled the ball from a Spencer cross.
Lewis Vaughan stepped up to the spot and converted sweetly past Ryan Fulton in the Accies goal.
The hosts doubled their lead on 25 minutes with an absolutely sublime finish from Dario Zanatta. Picking the ball up in midfield, the winger cut inside before curling an unstoppable effort into the top right-hand corner.
Two goals behind at the break, Brian Rice wasted no time and made two changes with Andy Ryan and Scott McMann replacing David Moyo and Callum Smith.
However, just seven minutes into the second half, it was 3-0 to the hosts with a fantastic finish. A lovely interchange teed up new signing Aidan Connolly who fired low across the face of the goal.
The hosts were in dreamland on the hour mark as Vaughan got his second of the afternoon making it 4-0 with a lovely chip over the helpless Fulton.
A twist in the tale was to occur moments later, this time it was Accies turn to score. Returning Rovers defender Kieran MacDonald found himself unmarked at the back post to head in for Accies with what seemed a mere consolation.
Fulton then made a superb save with his feet to deny Zanatta his second and Rovers fifth of the match.
The visitors made it 4-2 with a sublime finish from Andy Ryan with 15 minutes still to play. Cutting in from the left he rocketed the ball high into the top corner.
Christophe Berra then came close to putting the ball in his own net as Accies looked rejuvenated with their goals.
Sparking belief in the Hamilton camp, MacDonald’s second goal of the afternoon further reduced the deficit with 10 minutes remaining as the hosts struggled to get out their own half.
Minutes before time Raith debutant Fotheringham found himself through on goal with the chance to wrap up the match. A 2 on 1, he should have squared it to a Connolly who had the goal at his mercy but opted to go all alone clipping the top of the bar with his effort.
This would come back to bite the Dundee United loanee as in incredible fashion, Accies completed their four-goal comeback in added time. Reagan Mimnaugh’s cross found Want in the Rovers box, glancing his header into the bottom corner sparking scenes of ecstasy in the away end.
Man of the match – Dario Zanatta
Despite the last-minute heartbreak, Rovers fans should be proud of the attacking display on show yesterday. None more so than Zanatta. A rejuvenated player from his time at Ayr United, the Canadian was at the heart of everything, scoring a wondergoal to open his account in Rovers colours.
Raith: 1. J MacDonald, 2. Tumilty, 3. Dick, 5. Berra, 6. Benedictus (C), 7. Connolly, 10. Vaughan, 11. Zanatta, 13. Spencer, 15. Tait, 99. Poplatnik
Hamilton: 1. Fulton, 4. Stirling, 6. Hamilton, 7. MacDonald, 11. L Smith, 12. Want, 14. Spence, 18. Mimnaugh, 20. Moyo, 26. Redform, 32. C Smith
Referee: Nick Walsh