Town recorded a league double over West Ham after a convincing 5-1 win at Portman Road.
Goals from Michael Chopra and Daryl Murphy put Blues in front, before Jack Collison pulled a goal back for the Hammers.
However a penalty from Lee Martin and two second-half strikes from Jay Emmanuel-Thomas saw Town go on to win the game and record a first win of 2012.
Paul Jewell made two changes to the side that lost to Leeds, with Chopra replacing Jason Scotland in attack and Arran Lee-Barrett starting in goal in place of the suspended Alex McCarthy.
Town made a bright start and won the first corner of the game after just 23 seconds, with Winston Reid turning behind a dangerous Murphy cross.
Soon after Town were celebrating an opening goal, scored by the returning Chopra after just three minutes. Emmanuel- Thomas tricked his past a couple of defenders before picking out Chopra in the box and the striker finished emphatically past Robert Green.
The visitors responded to going a goal behind almost immediately and Carlton Cole almost levelled after six minutes, but the striker's looping header across Lee-Barrett came back off the post.
The Hammers were looking dangerous with their delivery from set-pieces and Lee-Barrett did well to punch a ball away from his goal with Cole and captain Kevin Nolan putting him under some aerial pressure.
Murphy was causing West Ham right-back Julien Faubert some problems down the left-hand side and the Celtic loanee danced beyond him once again after 21 minutes, before delivering a low cross into the box that skipped in front of Green's goal but unfortunately for Town Chopra was unable to apply a touch.
Both sides were working hard in an attempt to sustain a period of pressure, although chances were at a premium, with James Tomkins glancing a header wide from a Mark Noble corner five minutes before half-time.
However Town were denied a second four minutes before the break by a superb reaction save from the knee of Green, after Lee Martin's cross was flicked on by the faintest of touches from the head of Murphy.
But Murphy's hard work and endeavour was rewarded a minute before half-time as he doubled Town's advantage.
An Andy Drury corner was flicked to the back-post by Tommy Smith and Murphy was on hand to head into the top corner from inside the six yard box.
However the Blue Army had barely finished celebrating before the visitors pulled a goal back a minute later. Noble's delivery from a free-kick out wide on the left was glanced on by the head of Collison and went beyond the reach of Lee-Barrett and into the far corner.
But the first-half drama wasn't finished there and straight from the restart Town were awarded a penalty, after Chopra was bundled over in the box by George McCartney, who was shown a yellow card for his troubles despite the whole of Portman Road screaming for the left-back to be dismissed.
Martin stepped up and coolly slotted home the spot-kick in added on time to ensure Blues went in 3-1 ahead at the break.
Town started the second-half the brighter of the two teams and came close to extending the lead ten minutes after the restart, with Green doing well to tip an Emmanuel-Thomas volley behind for a corner.
However the Hammers were still posing a threat and Lee-Barrett made a superb double save on the hour mark, first at the feet of substitute Sam Baldock and then from Cole, before Luke Hyam got back to clear away the danger.
But it was Town who were to go on and score the next goal of the match, through a superb long-range drive from Emmanuel-Thomas that flew past Green and into the net, via the inside of the post after 64 minutes to put Blues 4-1 up.
Lee-Barrett, in for the suspended McCarthy, was again on hand to deny the Hammers front-line, this time keeping out a Henri Lansbury volley after Cole had headed into the midfielders path.
The visitors then missed a guilt-edged chance with 16 minutes remaining, as Baldock could only steer the ball wide of Lee-Barrett's goal following Matty Taylor's cross.
Then Lee-Barrett was on hand to keep out a Nolan drive, after the midfielder found space on the edge of the box. The Town stopper was again called upon, this time with six minutes remaining, and again he was in the right place at the right time as he saved well from Frank Nouble.
The impressive Drury had a chance to add a fifth for Town after racing clear with five minutes remaining, but he miscued his shot well wide of the target.
But Town did add a fifth deep into injury time, with Emmanuel-Thomas grabbing his second of the night with a cool finish beyond Green into the far corner after being played in by Scotland.
The win sees Town move away from the bottom three ahead of next week's clash against Coventry at the Ricoh Arena.
Town: Lee-Barrett, Edwards, Sonko, Smith, Cresswell, Emmanuel-Thomas, Drury, Hyam, Murphy, Martin, Chopra (Scotland 79). Subs not used: Wright, Bullard, Delaney, Leadbitter.
West Ham: Green, Reid, Tomkins, McCartney, Taylor (Hall 70), Faubert, Collison, Noble (Baldock 46), Nolan, Lansbury, Cole (Nouble 70). Subs not used: Faye, O'Neil.
Booked: McCartney, Nolan
Att: 22,185 (2,063 visiting fans)