Substitute Thierry Henry marked the final league game of his loan spell at Arsenal with a last-gasp winner to see off Sunderland 2-1.
The Frenchman struck in injury-time to claim the points after fellow replacement Aaron Ramsey had cancelled out the home side's lead on an eventful afternoon on Wearside.
James McClean had opened the scoring in the 70th-minute with Gunners defender Per Mertesacker, who had survived a first-half penalty appeal for handball, lying in a heap after catching his studs in the turf.
Sunderland went into the game defending a five-game unbeaten run and having won nine of the 13 games they had played under manager Martin O'Neill, while Arsenal last week crushed Blackburn 7-1.
A goalless first half saw McClean head over from Sebastian Larsson's near-post corner for Sunderland, and Theo Walcott fire wide from Robin van Persie's pass for Sunderland before volleying over.
Sunderland thought they should have been awarded a penalty just before the break when Mertesacker controlled Jack Colback's cross on his chest but then saw the ball rear up off the turf and hit his arm. Referee Neil Swarbrick disagreed.
Early in the second half John O'Shea blazed the ball over for Sunderland, while Wojciech Szczesny was called upon twice within as many minutes to deny Craig Gardner.
The breakthrough came when Mertesacker caught his studs in the turf and collapsed in pain, ending his game and allowing McClean to run clear to score.
On came Ramsey and he scored after just three minutes on the pitch, swivelling 20 yards out and striking a shot which hit both posts before crossing the line.
There was more drama to come as the game entered stoppage time when Henry, also a substitute, timed his run to perfection to turn Andriy Arshavin's cross past Simon Mignolet.