Ronaldo tapped in to cancel out Said Benrahma's opener and substitute Lingard appeared to have won the match for the visitors in the 89th minute. But there was time for late, late drama when the home side were awarded a penalty for a Luke Shaw handball in added time. Mark Noble came on to take the spot kick but United goalkeeper David de Gea dived to his left to keep it out, sparking a frenzy among United players.
United move into second place in the table, level on points with Liverpool. Ronaldo was jeered and whistled by the home fans at the London Stadium as he tried his trademark stepovers and feints but proved a handful throughout at the point of United's attack. The Portuguese superstar was supported by Paul Pogba, Bruno Fernandes and Mason Greenwood, with no starting place for Jadon Sancho, who has struggled to make an impact since his big-money move from Borussia Dortmund in July.
Ole Gunnar Solskjaer is still trying to work out how best to juggle his impressive forward resources and United are still seeking fluency despite a bright start to the Premier League season. West Ham proved a stern test for the visitors just five days after 10-man United crashed to a 2-1 defeat against Swiss side Young Boys in their Champions League opener.
Both sets of players lined up before kick-off as the stadium observed a minute's applause for England great Jimmy Greaves, who died on Sunday at the age of 81.
West Ham opener
West Ham, without suspended forward Michail Antonio, engineered the first clear opening of the game when De Gea was forced to save with his legs from a Jarrod Bowen shot. As the game opened up, West Ham goalkeeper Lukas Fabianski got his fingertips to a rasping Fernandes shot, touching it onto the post.
But it was West Ham who took the lead in the 30th when Benrahma's effort from the edge of the box took a huge deflection off Raphael Varane and completely wrong-footed De Gea. The goal galvanised the visitors and they were level just five minutes later, with Ronaldo poking the ball past Fabianski after the goalkeeper had saved his initial shot following a Fernandes cross.
Nikola Vlasic went close to restoring West Ham's lead, flashing over following a cross by Aaron Cresswell. Fabianski was called into action early in the second half racing off his line to block Ronaldo's effort when he had seemed destined to score. Both sides pushed forward as the second half wore on but there were few clear-cut openings.
Lingard, who spent a period on loan at West Ham last season, got a warm reception from the home fans when he came on as substitute alongside Sancho with 17 minutes to go, replacing Greenwood and Pogba. But he left the home fans with a bitter taste in their mouths when he curled a beautiful shot into the top right corner, which ultimately proved to be the winner.
In the other 1400 GMT kick-off, Brighton beat Leicester 2-1 to move up to third in the table ahead of the late kick-off between Tottenham and Chelsea, both former clubs of Greaves. Neal Maupay converted from the penalty spot with 10 minutes remaining of the first half following a handball by Jannik Vestergaard.
Danny Welbeck doubled the lead five minutes after half-time, flicking a near-post header past Kasper Schmeichel following a Leandro Trossard free-kick. Leicester pulled a goal back through Jamie Vardy but it was not enough.
Standout matches today