Mohd Azmi Muslim had fired the hosts ahead at the National Stadium in Bukit Jalil with a fine 30-yard strike in first-half stoppage time.
After missing several chances, the Gunners finally levelled with just four minutes left through 19-year-old German midfielder Thomas Eisfeld, and then snatched victory when Chuks Aneke's shot was deflected in.
With wantaway captain Robin van Persie one of several first-team players left to work on pre-season training back in England, centre-half Thomas Vermaelen skippered the side, which included Abou Diaby and Mikel Arteta in central midfield, while Marouane Chamakh led the attack.
Arsenal started brightly, with Gervinho looking lively down the left.
However, the Gunners were also careless in possession, as Norshahrul Idlan Talaha fired wide.
Diaby, fit again following just a handful of appearances last season, released Chamakh, whose angled shot was well saved.
In the 21st minute Arsenal number three goalkeeper Vito Mannone had to be alert to push behind a free-kick from Mohd Safiq Rahim.
As the half-hour passed, full-back Andre Santos blasted wide after good work from Chamakh and the Brazilian then saw his close-range effort saved.
At the other end, Mannone stood up well at his near post to beat away a fierce angled drive from Mohd Mohd Sali.
However, the Italian, who spent a loan spell with Hull last season, could do nothing when a 30-yard left-foot shot from Muslim flew past him in stoppage time to the delight of the home crowd.
Arsenal made the expected sweeping changes at the break, and substitute Alex Oxlade-Chamberlain, back in action after Euro 2012 action with England, had an early run at the Malaysia defence.
Malaysia midfielder Gary Steven Robbat let fly from 30 yards, but was off target.
Young Gunners forward Afobe, 19, latched onto a quick free-kick from Ryo Miyaichi and struck the post, but the flag was up for offside.
On the hour, Malaysia forward Sali burst clear and cut back inside, but his shot was straight at Mannone.
Afobe, who had a short loan spell at Reading last season following a long injury lay-off, should have levelled when he went through, but could not beat the Malaysia keeper.
The Gunners finally equalised with four minutes left when Eisfeld fired home after good work down the right by Nico Yennaris, and then snatched what had looked an unlikely victory when Aneke's shot was deflected past goalkeeper Mohd Marlias.
Arsenal now head to Beijing, where they will play Premier League champions Manchester City in the Bird's Nest Stadium on Friday.