Elano's header 18 minutes from time sank West Ham and handed Manchester City a FA Cup fourth round trip to Sheffield United.
West Ham's Dean Ashton clashes with Man City keeper Joe Hart
The Brazilian dived into the six-yard box after Rolando Bianchi headed Martin Petrov's cross against an upright.
Dean Ashton missed West Ham's best chance after 30 minutes when he volleyed Luis Boa Morte's cross against City keeper Joe Hart.
Boa Morte was also denied by Hart as City held on to clinch the win.
The first-half was a desperately poor affair, with little or nothing to excite an Eastlands crowd that was well below capacity.
West Ham's Ashton wasted their best first-half chance, but City keeper Hart blocked his close-range effort after Boa Morte created the opening.
City suffered a blow two minutes later when on-loan Mexican Nery Castillo fell awkwardly under a challenge from Lucas Neill and was stretchered off with a dislocated shoulder.
Hart got the better of Ashton again in first-half injury time, halting the striker as he tried to take advantage of Richard Dunne's error. The loose ball fell to Boa Morte, but he blasted wildly off target.
West Ham started the second half brightly, and Boa Morte was guilty of selfish play after 52 minutes, choosing to shoot straight at Hart with Freddie Ljungberg waiting unmarked only six yards out with the goal at his mercy.
City carved out their first opportunity after 56 minutes, courtesy of a superb Petrov cross that substitute Bianchi could not turn in at the far post.
Petrov was City's outstanding performer, and it was no surprise that he was instrumental when they went ahead with 18 minutes left.
He delivered a superb far post cross that was diverted against an upright by Bianchi, and Elano dived bravely into the six-yard box to head home the rebound.
West Ham almost restored equality with eight minutes left when Lee Bowyer lifted the ball over the onrushing Hart, but Micah Richards made a superb covering header to deny Ashton.
Manchester City manager Sven-Goran Eriksson:
"It is good to see Elano coming back to normal because he has been down for a little while.
"We have not had the real Elano since October or November. The last two times he has come back from the national team he has been injured. Then he was a bit sick, so he has not been training regularly.
"Thankfully, he has trained well for a few weeks now and physically, he is a lot better than he was a month ago.
"He is a world-class player and when you are looking for someone to do something special in the last third, he is the man."
West Ham manager Alan Curbishley:
"We dominated for long periods. I was pleased with most of what we did but we didn't find the back of the net.
"We took the game to Manchester City but we didn't get the goal and paid the price.
"It is disappointing to go out, because it is a competition that every team in the Premier League has got to attack because a Premier League team is going to win it."
Man City: Hart, Corluka, Richards, Dunne, Ball, Hamann, Ireland, Elano, Castillo (Bianchi 34), Petrov, Vassell (Gelson 81).
Subs Not Used: Schmeichel, Onuoha, Garrido.
Goals: Elano 73.
West Ham: Green, Neill, Ferdinand, Upson, McCartney, Ljungberg (Faubert 62), Bowyer, Noble, Etherington, Boa Morte (Cole 70), Ashton.
Subs Not Used: Wright, Mullins, Spector.
Booked: Boa Morte.
Ref: Mark Clattenburg (Tyne & Wear).
BBC Sport Player Rater man of the match: Vedran Corluke 6.85 (on 90 minutes).
Please note that you can still give the players marks out of 10 on BBC Sport's Player Rater after the match has finished.