Shortly after Tomlin got his marching orders for two yellow cards in quick succession, stewards had to intervene and separate a 20-man touchline fracas which broke out in front of the dugouts and culminated in Posh goalkeeping coach Jimmy Walker being sent to the stand.
Ranger, who had a superb game, headed Swindon into a 28th-minute lead as the visitors were caught cold by a short corner routine orchestrated by the impressive Alex Pritchard.
The on-loan Tottenham midfielder played the ball short to Massimo Luongo and his cross was headed in by Ranger, who celebrated his first goal for two months.
Swindon doubled their lead midway through the second half as Kasim broke from midfield and riffled a low, 20-yard shot into the bottom corner of the net.
Peterborough, who hit the post through Tomlin, had Swindon on the ropes for long periods of the second half but only Nathaniel Knight-Percival, with a superb individual goal, pierced an over-worked Town defence.