Dale captain Gary Jones made it 10 goals for the season with a first-half brace either side of Joss Labadie's effort for the visitors, but it appeared the hosts hopes of victory were dashed by Ian Thomas-Moore's penalty late in the second half.
But the points were secured when on-loan Scunthorpe striker Bobby Grant headed home Brian Barry-Murphy's corner in the 85th minute.
The breakthrough arrived in the 26th minute when Marlon Broomes hauled down Chris O'Grady, referee Carl Boyeson awarding a spot-kick and showing Broomes a red card. Jones planted a firm drive wide of Joe Collister to hand the hosts the lead.
Tranmere levelled in the 42nd minute through Labadie's neat finish but the home side restored the lead before half-time when Scott Wiseman's miscued attempt was forced over the line by Jones from close range.
Collister denied O'Grady and Jason Kennedy after the break before Ladabie was brought down in the area by Kennedy and Thomas-Moore levelled matters from the spot. But Grant ruined the visitors' day when he met Barry-Murphy's cross with five minutes