Sam Allardyce's first match in charge of the Hammers, who are favourites for promotion back to the top flight, was heading towards a damp squib of a goalless draw as the rain lashed down at Upton Park.
But Miller crashed a dramatic winner on his Cardiff debut as West Ham were given a stark reminder that the Championship may not be the cakewalk the bookmakers are predicting.
Hammered: Allardyce's side were beaten by a late Cardiff winner
West Ham: Green, O'Brien, Reid, Tomkins, Ilunga; Sears, Noble, Parker, Taylor; Nolan; Piquionne. Subs: Boffin, Faye, Collison, Barrera, Cole.
Cardiff City: Marshall; McNaughton, Taylor, Hudson, Gerrard; Whittingham, Cowie, Gunnarsson, Conway; Earnshaw, Miller. Subs: Heaton, Quinn, Gestede, Parkin, Mason.
Their midfield pairing of Kevin Nolanand Scott Parker would not look out of place in most Premier League teams but for various reasons they find themselves in the second tier.
Nolan is captaining the Hammers aftercontract talks with Newcastle broke down while Parker, named in the England squad to face Holland on Wednesday, is apparently happy to stay unless Tottenham or a top-four club come in for him before the end of the month.
Yet the illustrious duo could not break down a well-organised Cardiff side with a new manager of their own in Malky Mackay.
Parker should have put the home side ahead after 10 minutes when he found himself bearing down on goal but his touch let him down and Anthony Gerrard was able to make the challenge.
Miller time: Cardiff struck in injury time to steal all three points
Frederic Piquionne - preferred in attack to Carlton Cole - also had an early opportunity but his shot was blocked by the legs of Cardiff goalkeeper David Marshall, while Nolan headed wide and Freddie Sears blazed over.
Allardyce has also managed to keep hold of Robert Green, another member of Fabio Capello's squad, for the time being and the keeper was called into action to pull off a smart save from Don Cowie's header.
Green also had to tip Peter Whittingham's free-kick round the post as Cardiff finished the first half strongly while West Ham's early promise faded.
After the break Matt Taylor, another of Allardyce's summer recruits, tried to breathe some life into his new side.
I Kenny believe it! Miller celebrates his late winner
First the ex-Bolton midfielder cut inside and drove in a low shot which Marshall palmed away, then his strong run and cross was turned onto a post by Piquionne.
Defender James Tomkins thought he hadbroken the deadlock but his header was blocked on the line by Whittingham, while Marshall saved from Pablo Berrara a minute from time.
And as the clock ticked into stoppagetime Miller, who had hardly had a sniff all game, collected a pull-backfrom substitute Rudy Gestede and lashed the ball past Green, who got a hand to the ball but could not keep it out.
Off the line: West Ham had the better of the chances
Championship kick-off: Shaun Derry on the contenders and pretendersStoke join Spurs and Chelsea in ?8m chase for West Ham midfielder ParkerHacked off Hammers! Spurs face probe over Olympic Stadium bid 'snooper'