The Viola had gone 3-0 up by the 33rd minute but conceded three times to allow their visitors a dramatic comeback.
© AP Photos
Fiorentina seemingly had the matched wrapped up in the 33rd minute when Ljajic scored their third goal of the afternoon with a direct free kick.
However, Torino gave themselves a lifeline on the stroke of half time through Paulo Barreto, who fired in from outside the box to pull one back for the visitors.
The Turin side were right back into the contest in the 56th minute when Mario Santana scored with a shot taken from outside the box.
Torino's comeback was complete 13 minutes from time with another goal from long range, this time Alessio Cerci finding the target from outside Fiorentina's 18-yard box.
However, there was more drama to come at the Stadio Artemio Franchi in Florence, as set up by Mounir El Hamdaoui, Romulo scored the winner from the centre of the box.
Torino ended the game with 10 men as defender Matteo Darmian was sent off for a second bookable offence in injury time.