The Ukrainian, who made his first appearance for six months as a late substitute in their 2-0 defeat by Wolves, was introduced in the 78th minute with a topsy-turvy derby on a knife edge at 2-2.
There were no West Ham fans inside the London Stadium but the joyful roars of the players bellowing around the empty arena showed exactly what this victory meant.
"I know Yarmolenko can score. He has a good record. I felt the time was right to make a change," West Ham manager David Moyes said. "We were up against it at that time at 2-2 but the players stuck at it and we got a result.
"If you get to 40 [points] you will be safe in the Premier League so we have to aim for that tally. It probably means winning another three games.
Only the chronically bad form of their relegation rivals was keeping West Ham out of the drop zone after three successive defeats without scoring but victory lifted them above Watford into 16th spot with 30 points, three above drop zone.
Chelsea will be kicking themselves. Victory would have taken them third above Leicester City but now, with Manchester United and Wolves in hot form, their hopes of a Champions League spot, are under threat.
"It happens, it is the Premier League ... we dominated the game in terms of possession, but make mistakes and teams will hurt you," Chelsea coach Frank Lampard said. "I'm not happy with any of the goals.
"There were details in the game which we knew, but we lost because we didn't get them right."
It was a classic derby.
Soucek headed the hosts level on the stroke of halftime from a corner and then the hard-working Antonio converted in the 51st minute from close range after Jarrod Bowen played in a low cross.
Willian curled a free kick in off the post to punish a poorly-positioned Lukasz Fabianski in the 72nd minute.
And in a frenetic ending it was the unlikely figure of Yarmolenko who was to have the final say as West Ham sealed a league double over Chelsea for the first time since 2002-03.