Premier League: West Ham 1 Arsenal 2
West Ham came into the fixture having won six of their last seven league matches on home soil, and looked set to continue that impressive form when Alex Song found the net after five minutes.
The ex-Arsenal man's strike was swiftly chalked off for offside, but West Ham continued to look the better team for large spells of the opening period.
Santi Cazorla's penalty after being felled by Winston Reid in the 41st minute came somewhat against the run of play, before Danny Welbeck doubled the visitors' lead three minutes later.
Cheikhou Kouyate's headed goal nine minutes after the interval gave the home side hope of salvaging something from the tie, but Arsenal held on for maximum points.
Th result sees Arsenal go fifth, two points clear of West Ham, who now sit sixth.
Song returned to captain West Ham against his former club, as Sam Allardyce made five changes to the side that lost 2-0 at Chelsea on Friday, and had the ball in the back of the net after five minutes.
The midfielder lashed home from 25 yards when the ball fell to him from a corner, but the effort was ruled out after the linesman deemed Diafra Sakho to be in an offside position on the edge of the six-yard box.
Arsenal, who made three changes from their 2-1 win over QPR, struggled to find their feet in the early stages, and West Ham had appeals for a penalty waved away soon after the disallowed goal when Sakho went down under the challenge of Mathieu Debuchy.
Alexis Sanchez headed well wide from Arsenal's first real chance in the 16th minute, before seeing a driven effort deflected wide eight minutes later.
Debuchy flung himself to the floor after being caught by the elbow of Andy Carroll after 37 minutes. There did not appear to be much malice in the challenge, but the incident earned the West Ham striker a yellow card.
James Tomkins then squandered a golden opportunity to mark his 200th West Ham appearance with a goal when he lifted the ball over the crossbar from a Stewart Downing cross.
He was soon made to rue that miss, when a falling Reid caught Cazorla as he charged into the penalty area – the Spaniard burying the resulting spot-kick in the bottom left-hand corner of the net.
Arsenal made it two just three minutes later, with Welbeck sliding in to convert an Alex Oxlade-Chamberlain cross after a neat passing move.
Carroll headed narrowly over as West Ham looked to reduce the deficit at the beginning of the second half, but Kouyate had more success in the 54th minute as he nodded in off the head of Debuchy from a Tomkins cross.
Adrian got down brilliantly to his left to prevent Cazorla re-establishing the two-goal advantage soon after, before Reid tested Wojciech Szczesny with an improvised effort from 25 yards at the other end.
Welbeck came close to a brace when he drilled wide after charging down the left wing, and Adrian was forced into excellent saves from Oxlade-Chamberlain and Alexis late on.
Wenger will be grateful to come away from Upton Park with the three points, though, as his side were forced to cope with sustained injury-time pressure from the home side, culminating in Enner Valencia heading just over shortly before the final whistle.