Brentford won their second successive away game thanks to an Alan Connell strike, with virtually the last kick of the game.
The Bees had been leading thanks to Nathan Elder's first half goal, before Mark Hudson had equalised for the home side with just a few minutes remaining.
Andy Scott made two changes to the side that lost to Rochdale last Saturday, as well as a change of formation to 4-3-3. John Mousinho and Alan Connell were dropped to the subs bench, making way for the return of Gary Smith from injury, and a start for the on-loan Wayne Brown, who scored the winner in the Bees' last away win, over Grimsby on Easter Monday. Glenn Poole and Ricky Shakes joined Nathan Elder up front, with Smith, Brown and Kevin O'Connor making up the midfield trio.
Rotherham created the first real opening of the half as Derek Holmes cut inside from the left, his shot was blocked well by the outstretched leg of Craig Pead.
On five minutes Danny Harrison shot over from the edge of the box when well placed, before Nathan Elder saw his header easily saved by Andy Warrington at the other end.
Simon Brown&nbsp;was then equal to Holmes' looping header, before Ian Ross blazed over from twenty yards for the home side, following a decent lay-off from Tom Cahill.
Ryan Dickson then created the first major opening for the Bees, tearing down the left and cutting the ball back for Wayne Brown, who saw his first-time side-footed shot superbly saved by Warrington.
Brentford were beginning to dominate, with the midfield trio at the heart of proceedings, but the home side came close to taking the lead on 26 minutes, and indeed would have done but for a fantastic goal-line clearance from Alan Bennett. Simon Brown punched clear from a corner, but the ball dropped at the feet of Mark Hudson, who drove a powerful left-footed shot goalwards. With Brown stranded, Bennett dived to his left to head off the line and prevent a certain goal.
A few minutes later Dickson was on the rampage again, nut-megging Tonge and supplying a teasing cross which neither Elder or Shakes could capitalise on.
Smith then saw his left-footed shot from the edge of the box easily saved by Warrington after a patient build-up from the visitors.
Brentford got the goal they deserved on 39 minutes, and it was as simple as it was devastating. Dickson drilled a ball from just inside the Rotherham half, which Shakes expertly headed into the path of Elder. Elder raced onto the ball and slotted it past the on-rushing Warrington to put his side in front.
Rotherham reacted immediately, and Tonge should have done better when Hudson's cross found him unmarked at the far post, his header drifting wide of the goal and the attentions of the approaching Holmes.
Rotherham made a half-time substitution, Peter Holmes replacing the impressive Ian Ross, a decision which caused the home supporters to voice their disapproval.
However Holmes was soon busy causing Brentford problems as Rotherham attempted to get themselves back into the game.
Hudson shot way wide of the target following a blocked free-kick from the right, and at the other end Smith surged down the left before delivering a cross that narrowly eluded both Shakes and Elder.
The substitute Holmes then worked himself some space on the left but fired his shot straight down Brown's throat from twenty yards.
Wayne Brown saw his shot fly wide of the mark on 67 minutes, and a minute later Elder headed wide from eight yards after great build-up work between Shakes and Poole.
Elder then saw his header from a Pead cross saved comfortably by Warrington.
Craig Pead had to be alert to block a powerful shot by Jamie Green, before Millers' substitute Robert Newsham saw his shot saved high by Brown.
On 80 minutes Smith turned sharply to float in a left-footed cross from the right, which Elder met with a powerful header, which missed to Warrington's left.
Brentford made what would turn out to be two vital substitutions on 84 minutes, Alan Connell and John Mousinho replacing Nathan Elder and Ricky Shakes, and the Bees reverting to 4-4-2.
The home side began to press - Holmes slicing wide after a slip by Pead, and moments later Tonge heading straight at Brown when unmarked at the far post.
The equaliser came shortly afterwards. Hudson found himself in space on the edge of the box following Taylor's square pass, and his right-foot shot deflected off Alan Bennett and into the back of the net, giving Brown no chance.
Rotherham pushed forward, looking for the win and Holmes headed well wide before, in the final moments of three minutes of additional time, Brentford hit the home side with a superb breakaway goal.
Brown took a quick free-kick from within his box which found Mousinho. Mousinho looked to play the ball down the line to Connell, but with the striker offside, delayed the pass.
Connell checked his run, and as Mousinho released the ball, he found himself bearing down on Warrington's goal. Pablo Mills made a desperate effort to get back, but Connell simply cut inside the big defender, looked up, and curled home an unstoppable left-footed shot to seal a deserved win for the visitors.
Brentford: Simon Brown; Pead, Bennett, Heywood, Dickson; Wayne Brown, O'Connor, Smith; Poole, Shakes (Mousinho 84), Elder (Connell 84)
Subs (not used): Hamer, Reid, Osborne
Attendance: 2979 (119 Bees Fans)
Written by Matt Davis