SIMON Cox's first Albion goal four minutes from the end of extra-time swung this pulsating, marathon, Carling Cup tie the Baggies' way.
The hosts fell behind for the first time in the 98th minute when Tom Pope slammed home his second of the game to make it 3-2 to the League Two outfit.
But a Craig Beattie belter, also his second of the tie, levelled the scores three minutes later - before £1.9million summer recruit Cox won it in dramatic fashion.
The clash had been taken into extra-time after Albion twice surrendered the lead.
Beattie's tenth-minute opener was cancelled out by Micky Cummins' 29th-minute leveller before Graham Dorrans' 51st-minute cracker was pegged back by Pope's first 60 seconds later.
Rotherham, who knocked Wolves out of the competition on exactly the same date a year ago, deserve great credit for bridging the two-division gap to give Roberto Di Matteo's men a real run for their money.
But the Baggies just about deserved their fifth successive win as they reached the third round for the fourth time in five years.
Roman Bednar was given a rapturous welcome by the home hordes on his return to action following a three-month club suspension.
In total, Di Matteo rang nine changes which saw Abdoulaye Meite and Borja Valero make their first starts of the season, Reuben Reid line-up against his former club and Dorrans return from a one-match ban.
Both teams have enjoyed solid starts to the season and are currently occupying play-off berths in their respective divisions.
It may have been the smallest attendance at The Hawthorns so far this season, but the Baggies crowd was big on noise which helped drown out the boos from the away end every time Reid touched the ball.
It was the Millers, however, who recorded the first shot on goal, with Cummins shooting wide of skipper-for-the-night Dean Kiely's left-hand post after Dorrans had mishit a clearance.
Another poor 'boot out of defence', this time by on-loan Shaun Cummings, presented Nicky Law with a shooting chance from 18 yards - but Kiely was equal to it.
Albion soon made their presence felt at the other end - and Bednar was right at the heart of it.
The Czech striker's neat throughball almost created a goal for Reid, but Millers keeper Andy Warrington rushed off his line to block at point-blank range before Jamie Green cleared.
Moments later, Cummings whipped a terrific cross into the box and Bednar towered above the Millers defence to head just wide.
Albion then broke the deadlock in bizarre fashion in the tenth minute.
Beattie whipped a right-footed cross into the danger-zone which just evaded Bednar and deceived Warrington before nestling in the far corner of the net.
Rotherham certainly weren't fazed by their early set-back and Danny Harrison wasn't too far away with a ferocious 25-yard drive.
Marc Joseph was the next Miller to try his luck from distance, only to drag his 20-yard effort wide of the near post.
The long-range efforts continued at the other end but Bednar and Beattie were both well off target.
Scotland international Beattie was a lot closer with a near-post header from Marek Cech's 21st-minute corner, which just looped over the bar.
Albion were now piling on the pressure and only Dale Tonge's last-ditch block prevented Bednar volleying Reid's centre home after great work by Cox.
Rotherham only half-cleared the ensuing corner and Dorrans whistled a 25-yard rocket just over.
But Albion were hit by a sucker punch on 29.
Left-back Green swung in a terrific centre and Cummins rose above Cech to crash a header past the helpless KIely.
Albion were stung into action and great link-up play by Bednar and Cox set up a half-chance for Beattie who saw a first-time 20-yard drive awkwardly palmed away by Warrington.
But the equaliser injected real belief into United's game and they saw plenty of the ball during the closing stages of the half without threatening Kiely's goal.
It took Albion just six minutes of the second half to restore their lead.
Dorrans further cemented his standing as a fans' favourite when he controlled Bednar's lay-off on the edge of the box and jinked inside Nick Fenton before curling a sublime shot into the far top corner.
But Albion's advantage lasted barely a minute.
Rotherham broke upfield and, from a Law corner, Pope rose majestically to head home, again giving Kiely no chance.
The tie now had a real edge to it and Cox was denied by Warrington's stunning one-handed save at point-blank range after Dorrans' attempted throughball had broken kindly for him in the box.
Di Matteo made a double change on 64, with Cech and Bednar coming off for Joe Mattock and Chris Wood.
But Albion lost their way as the game descended into a lengthy scrappy passage of play.
The next shot at goal didn't arrive until the 78th minute when Kiely showed a safe pair of hands to clutch Harrison's 20-yard drive.
Di Matteo made his final throw of the dice on 79 when Youssouf Mulumbu came on for Reid.
Dorrans, who by now had been pushed out wide, went close five minutes from time when his low cross was deflected goalwards by Marc Joseph's outstretched boot - but Warrington saved smartly at his near post.
Albion threatened again in the fourth minute of stoppage time when Cox's goalbound shot was blocked by Pope on the edge of the six-yard box - but it wasn't enough to prevent extra-time.
The Baggies started the first added period on the front foot and Warrington had to pull off a terrific save to palm wide the dangerous Dorrans' 20-yard piledriver.
But the hosts found themselves behind for the first time in the 98th minute.
The Baggies rearguard made a hash of clearing their lines, which resulted in Pope expertly volleying home Leon Barnett's weak header from 15 yards.
In keeping with this seesaw of a cup tie, Albion levelled just three minutes later.
Beattie controlled a loose ball 25 yards out and smashed a stunning drive into the roof of Warrington's net.
Albion moved in for the kill and Cox fired just wide from an acute angle from Valero's lay-off.
Both teams began to jade as the second period got underway and Cummins failed to trouble Kiely with a miscued 20-yarder.
But it was Albion who had their noses in front again in the 116th minute.
Wood had the Millers defence back-pedalling with a rampaging run and the ball broke to Cox inside the penalty box who clinically fired into the far bottom corner.
There was still time for one last scare.
With the last kick of the game, the impressive Law curled a 25-yard free-kick goalwards, but Kiely pushed it to safety to guarantee Albion's passage into the third round.
ALBION (4-4-2): Kiely; Cummings, Barnett, Meite, Cech (Mattock 64); Reid (Mulumbu 79), Valero, Dorrans, Beattie; Bednar (Wood 64), Cox. Subs not used: Carson (gk), Olsson, Moore, Martis.
ROTHERHAM (4-4-2): Warrington; Fenton (R Taylor 94), Mills (Nicholas 119), Joseph, Green; Harrison, Tonge, Cummins, Law; Liddell (Ellison 76), Pope. Subs not used: Annerson (gk), J Taylor, Brogan, Lynch.
GOALS: ALBION - Beattie (10 & 101), Dorrans (51), Cox (116). ROTHERHAM - Cummins (29), Pope (52 & 98).
BOOKINGS: ROTHERHAM - Joseph (foul 112).
REFEREE: G Hegley (Hertfordshire).
ALBION STARMAN: Graham Dorrans.