The Gunners have now closed the gap to London rivals Chelsea - and extended their unbeaten run in the league to 11 games - while Bournemouth remain in eighth position after suffering a third successive defeat in the top flight.
Both teams started brightly on the South coast and Bournemouth should have taken the lead during the early stages when David Brooks slotted the ball past Bernd Leno from 12 yards out, but the Wales international was wrongly adjudged to have been offside when the ball ricocheted off Callum Wilson.
The visitors took time to grow into the match, but by the midway point of the first half they were beginning to create regular opportunities and Alex Iwobi and Aubameyang should have both done better with efforts inside the area.
However, Arsenal's goal eventually arrived in comical fashion as Lerma sent a volley from 15 yards into his own net after attempting to put Sead Kolasinac's cross behind for a corner.
Arsenal remained on the front foot with Iwobi seeing a curling effort from distance well kept out by Begovic, and it had reached a point where Bournemouth were looking forward to half time.
However, the Cherries stunned their opponents by finding an equaliser in the final seconds of the first half, with a blistering counter-attack involving Wilson and Brooks being finished off by King curling a shot into the top corner of the net from 16 yards out.
Both teams attempted to pick up where they had let off after the restart, but the end product was lacking and only a deflected Torreira came close to adding a third goal before the hour mark.
That attempt triggered a dominant period for the Gunners with Aubameyang firing over from 20 yards out, and it did not come as a huge surprise when the North London outfit regained the lead.
Kolasinac was found on the left flank and the wing-back's resulting cross was perfect for Aubameyang to divert the ball into the far corner from close range.
The goal led to Eddie Howe using all of his substitutions in quick succession, and the Cherries almost found a leveller through Junior Stanislas only for the winger to fail to get any power on his close-range effort.
Lerma then struck the post from all of 25 yards, before Sokratis Papastathopoulos was only saved from putting through his own net by Leno scampering across his line to claw the ball away.
Bournemouth had another chance to equalise with a free kick in the fifth minute of added-on time, but after Stanislas fired over the bar the referee blew for full time to confirm a hard-fought win for the visitors.
BOURNEMOUTH (4-4-2): Begovic; Francis, S Cook, Ake, Daniels; Brooks (Stanislas 73'), Gosling (L Cook 73'), Lerma, Fraser; King (Mousset 82'), Wilson
ARSENAL (3-4-3): Leno, Sokratis, Mustafi, Holding; Bellerin, Torreira (Guendouzi 79'), Xhaka, Kolasinac; Mkhitaryan, Iwobi (Ramsey 82'), Aubameyang (Nketiah 94')