But the basement strugglers could not hang on to their lead and their joy was short lived when Rovers levelled the scores within two minutes.
James Coppinger dribbled through on the left and when his cross came over Jonathan Forte saw his shot blocked but Heffernan reacted quickest when the ball rose in the air to head home in opportunist style.
Rovers had the upper hand after that but tried too hard to force the play at times and were unable to cash in on their superiority.
Paul Green had a header cleared off the line from the resulting corner but Doncaster did not have long to wait before snatching the lead in the second half.
Brian Stock sent over a corner which hung in the air and Graeme Lee charged in to plant a towering header into the roof of the net.
Price fired home soon after only to have the effort disallowed for offside but there was no mistake when Heffernan made it 3-1 in the 59th minute when he hammered home his 14th goal of the season.
Doncaster were well on top at that stage and should have gone on to score more but it was Rotherham who pulled one back against the run of play in the 71st minute.
It strung Rovers into action and Heffernan was mysteriously denied a hat-trick when he fired home in the 72nd minute only to have the effort disallowed.
Coppinger hit the post in the 87th minute and Forte was inches away from adding a fourth as Rovers finished well on top.