Clarence Seedorf suffered his first Serie A loss as Rossoneri boss having previously enjoyed wins over Hellas Verona and Cagliari in his opening two league games and, while his new side fought back from a goal down, they could not extend their winning league run.
Ciro Immobile put Torino ahead with an impressive solo effort, cutting inside Daniele Bonera when through on goal before sidefooting home past Christian Abbiati.
Rami was perhaps an unlikely candidate to level the scores, but the defender struck early in the second half to bring Milan back into the game.
Despite enjoying plenty of the possession and threatening late on, Milan lacked a cutting edge without the in-form Mario Balotelli - missing due to suspension.
Giampaolo Pazzini scored his first Serie A goal since April against Cagliari last Sunday and was rewarded with a starting spot - replacing Balotelli up front.
And the former Inter striker almost opened the scoring when he turned well in the area and forced Daniele Padelli into a smart save in the second minute.
However, while Milan enjoyed plenty of possession, the visitors looked dangerous on the break and went ahead after 17 minutes through Immobile. Having done well to spring the offside trap, the 23-year-old kept his composure and evaded the attentions of Bonera to slot home his 11th league goal of the season.
Padelli was called into action soon afterwards to deny Pazzini for a second time, saving from an acrobatic effort before Alexander Farnerud headed over Alessio Cerci's cross following another dangerous break just before the half-hour mark.
The Torino goalkeeper was in fine form right through to the interval, denying long-range strikes from Sulley Muntari and Kaka to keep his side ahead.
Milan were level four minutes after the break when Rami registered his first goal for the club with a powerful drive from outside the area. The Valencia loanee's shot took a deflection on its way and beat Padelli as the French defender opened his account for Milan.
Robinho thought he had put the hosts ahead shortly before the hour, only for his effort to be ruled out for offside, as they continued to dominate.
Kaka's deep cross was well dealt with by Padelli late on as Torino held on to come away with a point, while Milan failed to come from behind and win in Serie A for a fourth time this season.