Fulham fought back after squandering an early lead to beat West Ham at Craven Cottage.
A header from Dimitar Berbatov saw Fulham take the lead after 10 minutes despite suspicions of offside.
Kevin Nolan reacted to a quickly-taken free-kick to equalise just after half-time but Hugo Rodallega's header restored Fulham's lead within a minute.
Mladen Petric's shot from a tight angle went in off West Ham's Joey O'Brien to secure the win in stoppage time.
Berbatov 'most gifted ever seen'
The result saw Fulham leapfrog over West Ham, now without a win since New Year's Day, to ease worries after a run that had seen Martin Jol's side slip down the table.
The game's first chance came after less than 30 seconds when Joe Cole spurned a good opportunity to shoot wide, but it was the home side who took the lead after just 10 minutes.
Damien Duff's free-kick from the right of the West Ham box floated over a packed penalty area, before flicking off Brede Hangeland's chest to the lurking Berbatov on the far post.
The Bulgarian nodded the ball past Jaaskelainen for a simple goal but, together with the West Ham defence, he looked to the officials to check whether he would be flagged for offside. Despite replays suggesting that he was, the goal stood to give Berbatov his eighth of the season.
Could do better
The win was only Fulham's second over West Ham in 12 meetings between the two at Craven Cottage since 1975
The former Manchester United striker, celebrating his 32nd birthday, was at his languid best as Fulham held their visitors at bay on the cushion of the early goal.
Bryan Ruiz and Rodallega built on neat work from Berbatov in several moves, with Ruiz drilling a shot at Jaaskelainen, who also reacted quickly to dive at Rodallega's feet to snuff out another chance.
Cole's early miss apart, West Ham's only other chance of note in the first half came on the half-hour, when Kevin Nolan saw his close-range header bounce a yard wide of the post.
Steve WilsonBBC Match of the Day commentator
Only their second league victory of 2013, Martin Jol's side leapfrog above Sam Allardyce's West Ham, with a 3-1 victory which they had to work ever so hard to get. Hugo Rodallega's goal came only 40 seconds after the equaliser from Kevin Nolan. Berbatov, brilliant in the first half, got the first albeit from an offside position.
Berbatov continued to pose a threat, going on a loping run late in the first half before shaving the post with his shot from just outside the area.
West Ham looked like a different side in the opening exchanges of the second half, and they were level three minutes after the re-start when Kevin Nolan span away from Berbatov at a quickly-taken free-kick to shoot home from an angle.
But Fulham hit back immediately through Rodallega, who climbed above two West Ham defenders to head a Damien Duff cross past Jaaskelainen.
The flurry of goals roused both sides, with Mark Schwarzer making a fine save low to his left to deny another angled effort from Nolan.
West Ham conceded poor goals
Berbatov was in the action again with a shot flashing across Jaaskelainen, but after appearing to tweak a hamstring his contribution ended with 15 minutes remaining.
Andy Carroll went close to marking his first taste of action since 28 November with a goal within a few seconds of replacing midfielder Cole, forcing Schwarzer into action with a low shot from the edge of the area.
But the hosts held firm and they sealed their three points on 90 minutes when Petric, who had replaced Berbatov, saw his shot from the tightest of angles finally roll in off the unlucky O'Brien.
Fulham manager Martin Jol said
: "West Ham were two points above us, so we needed this win. We had some good games lately, but could not get the results. We had a lot of draws, we should have won the Swansea game so we were struggling.
"We had to play Man City and Man United away from home, and we've got to play United again on Saturday which is not going to be easy for us. In between we had to play West Ham, and we did what we had to do tonight.
"They were very important, vital points to us and it was vital to them as well. I'm happy because we got the points, and we're on 28 points now."
West Ham assistant manager Neil McDonald said
: "We work very hard in training that when we do score we have to keep it tight, unfortunately we didn't stop the cross and we let him (Rodallega) get his chance which was disappointing for us. We very rarely concede goals like that.
"We have a lot of positives to take, we created a lot of chances and we have people coming back, which adds to the squad and hopefully we'll have better results in the remaining games."
Dimitar Berbatov has an effort from just inside the box that misses to the left of the target.
Joe Cole takes the inswinging corner, Dimitar Berbatov makes a clearance.
Corner taken by Joe Cole, Carlton Cole has a headed effort at goal from deep inside the area missing to the right of the goal.
Kevin Nolan takes a shot. Save by Mark Schwarzer.
Substitution Matthew Taylor joins the action as a substitute, replacing Guy Demel.
Substitution Ashkan Dejagah joins the action as a substitute, replacing Bryan Ruiz.
Steve Sidwell fouled by Mohamed Diame, the ref awards a free kick. Free kick taken by Steve Sidwell. Corner taken by Damien Duff from the left by-line played to the near post, Carlton Cole manages to make a clearance.
Substitution Chris Baird comes on in place of Giorgos Karagounis.
Kevin Nolan takes a shot. Mark Schwarzer makes a save.
The ball is delivered by Joe Cole, Mark Schwarzer makes a save.
Steve Sidwell gives away a free kick for an unfair challenge on Joe Cole. Free kick taken by James Tomkins.
Mohamed Diame concedes a free kick for a foul on Dimitar Berbatov. Giorgos Karagounis takes the free kick.
Booking Sascha Riether receives a yellow card.
Sascha Riether challenges Mohamed Diame unfairly and gives away a free kick. Mark Noble takes the direct free kick.
Free kick awarded for a foul by Winston Reid on Dimitar Berbatov. Bryan Ruiz takes the direct free kick.
The ball is crossed by Joey O'Brien, save by Mark Schwarzer.
Substitution Carlton Cole joins the action as a substitute, replacing Marouane Chamakh.
The ball is sent over by Matthew Jarvis, save made by Mark Schwarzer.
Guy Demel delivers the ball.
Giorgos Karagounis fouled by Mohamed Diame, the ref awards a free kick. Bryan Ruiz takes the direct free kick.
Assist by Damien Duff.
48:47 Goal scored
Goal! - Hugo Rodallega - Fulham 2 - 1 West Ham Hugo Rodallega grabs a headed goal from close range. Fulham 2-1 West Ham.
Assist on the goal came from Mark Noble.
47:35 Goal scored
Goal! - Kevin Nolan - Fulham 1 - 1 West Ham A goal is scored by Kevin Nolan from close in to the bottom right corner of the goal. Fulham 1-1 West Ham.
Bryan Ruiz gives away a free kick for an unfair challenge on Mohamed Diame. Mark Noble restarts play with the free kick.
The ball is swung over by Guy Demel, Philippe Senderos makes a clearance.
The ball is sent over by Guy Demel, clearance made by Bryan Ruiz.
Matthew Jarvis sends in a cross, Giorgos Karagounis manages to make a clearance.
The second half has started.
45:00 +1:24 Half time
Half Time The first half comes to an end.
Joe Cole produces a cross, clearance by Hugo Rodallega.
Corner taken by Joe Cole played to the near post, Brede Hangeland manages to make a clearance.
Dimitar Berbatov has an effort at goal from just inside the box that bounces off the post.
The offside flag is raised against Joe Cole. Mark Schwarzer takes the free kick.
Dimitar Berbatov produces a cross, clearance by James Tomkins.
Giorgos Karagounis concedes a free kick for a foul on Marouane Chamakh. Mark Noble takes the direct free kick.
The referee blows for offside against Mohamed Diame. Indirect free kick taken by Mark Schwarzer.
Corner taken by Joe Cole played to the near post, Dimitar Berbatov makes a clearance.
Free kick awarded for a foul by Steve Sidwell on Mohamed Diame. Jussi Jaaskelainen takes the indirect free kick.
Booking The referee shows Steve Sidwell a yellow card.
Mohamed Diame delivers the ball, Header from close in by Kevin Nolan misses to the left of the goal.
A cross is delivered by Matthew Jarvis, save by Mark Schwarzer.
Effort from the edge of the box by Damien Duff goes wide of the right-hand upright.
Joe Cole gives away a free kick for an unfair challenge on Damien Duff. Free kick taken by John Arne Riise.
Guy Demel produces a cross, Matthew Jarvis has a header from deep inside the six-yard box and clears the crossbar.
The assistant referee signals for offside against Dimitar Berbatov. Jussi Jaaskelainen takes the free kick.
Free kick awarded for an unfair challenge on Joey O'Brien by Bryan Ruiz. Jussi Jaaskelainen takes the free kick.
Joe Cole sends in a cross, clearance made by Sascha Riether.
Hugo Rodallega takes a shot from just outside the penalty area which clears the crossbar.
Foul by Guy Demel on Damien Duff, free kick awarded. Free kick taken by Mark Schwarzer.
Damien Duff is flagged offside by the assistant referee. Jussi Jaaskelainen restarts play with the free kick.
Kevin Nolan gives away a free kick for an unfair challenge on Giorgos Karagounis. Steve Sidwell takes the free kick.
Corner taken by Joe Cole played to the near post, clearance by Brede Hangeland.
Assist on the goal came from Damien Duff.
9:39 Goal scored
Goal! - Dimitar Berbatov - Fulham 1 - 0 West Ham Dimitar Berbatov finds the back of the net with a headed goal from close in. Fulham 1-0 West Ham.
Foul by Winston Reid on Hugo Rodallega, free kick awarded. Damien Duff takes the free kick.
Damien Duff produces a cross, clearance made by Mohamed Diame.
Bryan Ruiz takes a shot. Jussi Jaaskelainen makes a save.
Joe Cole takes the inswinging corner, Bryan Ruiz manages to make a clearance.
Free kick awarded for an unfair challenge on Marouane Chamakh by Steve Sidwell. James Tomkins takes the free kick.
This page is best viewed in an up-to-date web browser with style sheets (CSS) enabled. While you will be able to view the content of this page in your current browser, you will not be able to get the full visual experience. Please consider upgrading your browser software or enabling style sheets (CSS) if you are able to do so.