Keith Hill's side stormed out of the blocks with two goals in the opening seven minutes.
They opened the scoring after five minutes when Adam Le Fondre teed up Gary Jones on the edge of the area and he drilled the ball into the bottom corner past Andy Warrington.
Two minutes later, Le Fondre sent the visiting fans into raptures as he guided the ball home after Glenn Murray had flicked on a cross from Tom Kennedy.
Rotherham, who had not lost in the league since the end of September, reacted positively and by the time 15 minutes had elapsed they were level.
Sixty seconds later they were level when Stephen Brogan and Chris O'Grady burst forward with the ball breaking for Derek Holmes who cut inside onto his left foot and blasted past Sam Russell.
Sharps had to be alert at the other end on 36 minutes to clear Le Fondre's shot off the line.
Then on the stroke of half-time his defensive partner Graham Coughlan was denied by a brilliant save from Russell.
Just as they did in the first half, Rochdale caught Rotherham out right at the start when Murray rose highest to get a flick header onto Kallum Higginbotham's corner with the ball crashing in off the underside of the crossbar.
Substitute Marc Newsham spurned Rotherham's best chance to extend their unbeaten run when he blazed wide when it looked easier to score.
In stoppage time, Rochdale put the seal on an impressive win which extends their own unbeaten run to four games when Lee McEvilly steered home Murray's cut back and the ball trickled over the line.