Hammers twice came from behind against their first division opponents and, in a frenetic last half-hour, survived a disallowed goal and penalty miss by the visitors who must be scratching their heads in bewilderment that they didn't at least force a replay of this absorbing third round FA Cup clash.
Jermain Defoe, looking sharper than of late, levelled Forest's opener - another gift from David James - and though Andy Reid volleyed to make it 2-1, Joe Cole surged into the box to drive a second equaliser.
There was a suspicion of offside as Defoe gained possession on the left with seven minutes of normal time to play. But the young England under-21 striker held off Chris Doig before unleashing a shot that deflected just inside the far corner of the net.
Glenn Roeder said he would take any kind of victory at home and, having succeeded at the 13th attempt, he'll believe that such luck on East London turf was long overdue.
He will not be kidding himself, though, that this is necessarily the turning point in a season where Premiership survival must come way ahead of FA Cup aspirations. For the result cannot mask continuing problems in a shaky defence.
Hammers made the brighter start but the afternoon threatened to turn bleak after James, still haunted by his Blackburn blunder a week ago, spilled a soft Reid shot from the left that presented Marlon Harewood with an easy tap-in on 17 minutes.
The West Ham keeper's every touch thereafter was greeted with ironic jeers by an unforgiving home crowd, who also took out their frustration on Trevor Sinclair, who had too many loose touches for their liking in the first half.
Cole, restored to his favoured central midfield role where he can cause maximum damage, dominated the opening period, driving forward and creating just about everything Hammers had to offer against a well organised and neat passing Forest outfit.
It was Cole, first skilfully controlling on the run, who spotted Defoe's diagonal run and fed the ball to the striker, who cut inside before curling his shot inside the far corner of the net at the Centenary Stand end after 26 minutes.
The same two players were involved in Hammers' only other clear chance just before half-time. Cole picked out Defoe with a pinpoint cross that the No.9 dived to head into the arms of keeper Darren Ward.
Manager Paul Hart's tactic of playing the tall Harewood wide on the right, where his height and pace caused Nigel Winterburn persistent problems, paid off five minutes into the second half. Harewood got the better of both Winterburn and Christian Dailly before his deep cross was powerfully volleyed in at the far post by Reid, who stole a few yards on Sebastien Schemmel.
The veteran Winterburn was almost caught out again five minutes later, but this time he just recovered to nick the ball off the feet of Harewood and back to the jittery James.
With an hour played, Forest couldn't have contemplated defeat but the game swung back Hammers' way when Defoe returned the compliment to Cole, who ran onto his pass, roasted Michael Dawson on the outside and fired a right-foot shot beyond the outstretched right arm of Ward for 2-2.
Within two minutes, though, the cheers turned to groans when referee Paul Durkin rightly awarded a penalty after spotting Dailly's tug on Harewood in the melee that followed Forest striking the crossbar. But Johnson's woeful spot kick was drilled wide of James' left upright.
Ian Pearce made little impact up front but rather than move him back into the back four, where Winterburn's ageing legs deserved a rest, Roeder withdrew him and sent on Titi Camara to play alongside the lively Defoe.
With just 10 minutes to play, Camara could have made himself a cup hero but after Sinclair headed Defoe's byline cross back to the waiting substitute, Camara slashed an air shot and a golden match-winning chance went begging.
But as Hammers fans and players pondered an unwanted replay at
the City Ground, Defoe capped a good performance with his 83rd
Upton Park roared its approval before most of the 29,612 crowd booed a minute later when Winterburn was finally relieved of duties and replaced by Tomas Repka. The reception the ill disciplined Czech received was much cooler than the icy chill felt around the Boleyn Ground.
Forest didn't deserve to lose but Hammers must thank the referee's assistant who did well to spot Harewood's clear shove in the back of Dailly that finally persuaded Durkin to disallow the visitors' late effort.
Roeder admitted: 'We've played better than that at Upton Park this season and lost. It's a strange game.'
The Hammers boss identified Defoe and Cole as his side's most outstanding players but also singled out Michael Carrick for credit.
Ahead of next week's home league match against one of his former clubs, Newcastle United, Roeder remains upbeat about Premiership survival prospects, adding:'We're confident that we have enough quality here to pull our way out of the bottom three and let's hope that today proves a turning point.'
1 - Hammers survive an early scare, as Johnson beats Schemmel and whips in a dangerous cross from the left that only just misses the boot of Harewood.
4 - Dailly dives to meet Carrick's near-post corner, but fires his header well wide of the target.
8 - After some intricate build-up play involving Carrick and Defoe, the ball runs loose on the edge of the area to Sinclair, who fires a bending right-foot shot just wide of the far post.
10 - Hammer go close again, as Breen finds Defoe, who turns well on the right and cuts inside before firing his left-foot shot just inches wide of the target.
17 - GOAL. Upton Park is stunned into silence as, for the second week running, goalkeeper David James gifts the opposition an unbelievable opening goal. There appears to be no danger as Reid's weak cross-shot bobbles towards the Hammers stopper, but as he collects the ball, James somehow allows it to slip from his grasp and it rolls on to the goal-line, where Harewood gratefully bundles it over the line. West Ham United 0 Nottingham Forest 1.
20 - Schemmel spots Cisse's overlapping run on the right and feeds the ball in for his fellow countryman, who scoops his shot over Ward but wide of the far post.
26 - GOAL! Hammers respond with a goal straight out of the West Ham United youth academy. Carrick's superb upfield pass finds Cole, who in turn splits the Forest defence to release Defoe. The young striker cuts inside Doig before firing an instant snap-shot past the dive of Ward to bring Hammers level. West Ham United 1 Nottingham Forest 1.
34 - Louis-Jean booked for foul on Sinclair.
39 - Schemmel's driven cross reaches Defoe at the far post, but the young striker can only direct his diving header straight at Ward.
Added time: 1 minute
45 - Scimeca's corner kick reaches the far post, where Louis-Jean is handed a simple chance to give Forest the lead again, but blazes his shot high over the bar.
47 - The unmarked Dawson meets a cross from the right but his header flies wide of the target.
50 - GOAL After enjoying the livelier start to the second half, Forest take the lead again, as Harewood skips down the right and beats Winterburn before lofting a cross to the far post, where Reid is waiting to volley emphatically past James from 10 yards out. West Ham United 1 Nottingham Forest 2.
51 - Hammers almost bounce back immediately, as Breen meets a cross from the left but sees his header tipped over by Ward.
55 - Forest come close to adding a third, as a long clearance upfield somehow releases Harewood clean through on goal. However, veteran defender Winterburn gets back to deny the striker with a superb last-ditch sliding tackle.
61- GOAL Hammers get back in it again, as Schemmel and Defoe combine well on the right, allowing the overlapping Cole to gain possession and beat Dawson before firing the ball low into the bottom corner of the net. West Ham United 2 Nottingham Forest 2.
62 - Amazing scenes as Forest fight back immediately, with Harewood racing into the box on the left and crossing low into the six yard box, where the ball cannons off Johnson and against the post before rebounding out. However, as Johnson attempts to stab home the loose ball, he is held by Dailly and referee Durkin points to the penalty spot.
63 - Johnson steps up and fires his left-footed spot-kick just wide of James' left-hand post to leave the scores still level.
68 - Sinclair's clever flick finds Defoe, who cuts past Dawson on the left and fires in a blistering shot that Ward does well to turn round the post.
74 - Substitution for West Ham, Camara replaces Pearce.
80 - Defoe does well on the right to beat Brennan and chip over a cross to the far post that is nodded back by Sinclair for Camara, who wastes his chance of glory by completely missing the ball as it drops in the six yard box.
81 - Cole, trying his hardest to find a breakthrough, weaves his way to the edge of the area and manages to find Sinclair, whose shot takes a deflection and wrong-foots Ward, who watches gratefully as the ball dribbles just past the post.
83 - GOAL! Hammers finally take the lead for the first time in the match, and it's that man Defoe again. The young striker races on to a long ball over the top and holds it up in the penalty area before twisting and turning and firing in a low right foot shot that takes a deflection on it's way into the bottom corner of the net. West Ham United 3 Nottingham Forest 2.
85 - Substitution for West Ham, Repka replaces Winterburn.
88 - Forest force the ball home from a corner, but the goal is ruled out after the linesman spots a handball in the six-yard box.
Added time: 2 minutes.
Full time: West Ham United 3 Nottingham Forest 2.