A 14th minute strike from Darren Byfield earned the Millers all three points in a game that saw a Jekyll and Hyde performance from Hammers, who were dreadful in the first half and, although much improved in the second, couldn't make the breakthrough to snatch a point at least.
The Hammers boss had made one enforced change to the team that started the 0-0 draw against Sheffield United last week. Rufus Brevett's ankle injury meant a defensive reshuffle and, with Anton Ferdinand returning from his own ankle problem, Tomas Repka was surprisingly switched to left-back.
Clearly uncomfortable in his new role, the Czech defender struggled as Hammers made a sloppy start, with the hosts making all the running and piling on pressure down the flanks.
Byfield had already seen one effort drop wide and another saved by James before he was presented with the chance to give Rotherham the lead in the 14th minute. Former Hammers full-back Scott Minto collected possession on the left and fed Stewart Talbot, whose cross from the left found Byfield unmarked 12 yards out, from where he volleyed a shot past James into the top corner.
The goal was nothing less than Rotherham deserved and, quite honestly, it would have been no surprise if they had doubled their tally before the break as Hammers endured a torrid time in all areas of the field.
With the hosts cutting off the supply out wide, James and his defence resorted to pumping high balls forward to the pint-sized striking partnership of Defoe and Connolly and, when the expected clearances from Rotherham's central defenders dropped, the Hammers' midfield were often too deep to put pressure on in the attacking third.
Apart from a couple of speculative long-range efforts from Defoe and Connolly, the visitors didn't force a single save out of Rotherham keeper Mike Pollitt in the first 45 minutes and, perhaps more disappointingly, looked incapable of playing the kind of passing game that should stand them apart from most teams in this division.
Hammers went in at half-time with the jeers of the travelling support ringing in their ears and it was no real surprise to see changes made by Roeder. On came Richard Garcia and Michael Carrick - for his first taste of Nationwide football since recovering from a serious groin injury - in place of Ferdinand and the lacklustre Don Hutchison.
Horlock dropped back to left-back, while Repka moved across to a more familiar right-back role and, with Carrick adding some much-needed link-play between defence and attack, Hammers at last began to switch on and threaten to make a game of it.
The added passing quality and forward-thinking of Carrick was the key difference and it is plainly obvious that his return to full fitness can't come quick enough for Roeder's men. The Geordie midfielder's presence also had a positive effect on Defoe, who sparked into life after the break in anticipation of receiving some decent service from his young team-mate.
After wriggling free on the right in the 57th minute, the England under-21 striker fired in a superb low cross that caught the Rotherham defence off-guard but also fooled Connolly, who failed to react in time just six yards out.
Garcia, who bounced back well from the embarrassment of becoming a substituted substitute against Sheffield United last week, went close on a couple of occasions, and was just inches away from claiming his first goal in a Hammers shirt when Defoe's stunning free-kick crashed off the post in the 76th minute and dropped to the young Aussie who, off-balance, scuffed the ball goalwards only to see a defender clear off the line.
Two minutes later, Defoe had an even better chance to draw level. Released by Neil Mellor - on as a 66th minute substitute for Connolly - he burst clear of the last man and the Hammers fans behind the goal were preparing to pay tribute to their young hero as he bore down on goal, only to see Pollitt race out and smother the effort.
That miss proved to be decisive, and Hammers were dealt a further blow with 10 minutes remaining when Christian Dailly was forced off with blood pouring from his mouth following an off-the-ball incident. With all three substitutes used and the fourth official refusing to allow the Hammers skipper back on unless club doctor Ges Steinbergs could stem the flow of blood, the visitors were forced to play out the remainder of the game with 10 men.
That understandably slowed the pressure and, although Hammers finished the stronger, Rotherham were grateful for the extra space in attack that allowed them to hold on to possession and wind down the clock whenever possible.
The final whistle brought more boos from the frustrated travelling fans, and no doubt just as much frustration for Roeder and his team, for whom it was sadly a case of too little, too late on a day when they had the chance to prove that they are ready and willing to face difficult and scrappy encounters like these knowing that they will match their plucky opponents for desire, work-rate and playing to their full abilities.
If they didn't know it already, Hammers have certainly learnt a harsh lesson about life in the Nationwide League and things won't get any easier unless provide the quality shown in the second half for the entire 90 minutes.
Minute-by-minute:
1 - Horlock booked for foul on Sedgwick.
8 - Rotherham go close as a deep corner is headed into the six yard box, where Byfield pulls off an acrobatic scissors kick that drops just over the bar.
10 - Dailly's terrible back-header lets in Barker, but the striker slips at the vital moment and wastes his chance.
11 - Byfield beats Dailly to the ball on the right and cuts inside before firing a left-foot shot straight at James.
14 - GOAL. After making by far the better start, Rotherham take a deserved lead as Minto finds Talbot, whose cross is volleyed home by the unmarked Byfield from 10 yards out. Rotherham United 1 West Ham United 0.
21 - A threaded pass from Lee finds Connolly, who turns on to his left-foot on the edge of the penalty area but fires well wide of the target.
32 - Lee's pass finds Defoe, who surges at goal before shooting just wide.
33 - Another close shave for Hammers, as McIntosh's point blank header is well saved by James at his near post.
36 - James comes to the rescue again, diving full stretch to his right to tip Byfield's fierce low shot around the post.
37 - Dailly races out of defence on a break-away attack after James collects a corner and sets up Lee, whose weak shot is deflected straight into the arms of Rotherham keeper Pollitt.
40 - Swailes booked for foul on Connolly.
43 - Sedgwick booked for foul on Etherington.
Added time: 2 minutes.
Half time: Rotherham United 1 West Ham United 0.
Second Half:
46 - Double substitution for West Ham, Carrick replaces Ferdinand and Garcia replaces Hutchison.
49 - A livelier start from the Hammers, as Defoe's cross from the right is blocked and Garcia's volley drops wide of the far post.
55 - A long ball forward from Horlock is headed down by a defender to the edge of the penalty area but Garcia fires his shot just wide.
57 - Another good chance for the Hammers, as Defoe wriggles free on the right before firing an inviting low cross along the six yard box that Connolly is just inches from making contact with.
66 - Substitution for West Ham, Mellor replaces Connolly.
73 - Dailly's weak header allows Barker in on the right but the striker's shot is saved by James and Pearce clears the loose ball.
75 - Monkhouse booked for foul on Garcia.
76 - After Garcia is fouled some 25 yards out, Defoe steps up to curl in a superb free-kick that Pollitt tips on to the post. The ball rebounds out to Garcia, who agonisingly fails to get a strong enough touch on the ball and a defender clears off the goalline.
78 - Hammers look set to equalise as Mellor releases Defoe clean through, but the England under-21 striker is denied by Pollitt, who races off his line to superbly block the effort.
80 - Captain Dailly goes off with a facial injury following an off-the-ball incident and, with all three substitutes used, Hammers are down to 10 men.
Added time: 4 minutes.
Full-time: Rotherham United 1 West Ham United 0.