Marcus Browning struck with a stoppage-time goal, his first in any competition for three years, to earn Bournemouth an unexpected win and deny Oldham's brave fightback.
Oldham were two goals down at half-time and looking to be heading for a heavy defeat but manager John Sheridan made some tactical changes for the second half by sending on Paul Warne and Craig Rocastle.
The visitors were gifted a goal straight from the kick-off at the start of the second half.
Bournemouth defender Eddie Howe, without an Oldham player even in his half of the pitch, attempted to head the ball back to his goalkeeper but succeeded only in directing it onto his arm.
Surprised Oldham could hardly believe their luck and Andy Liddell compounded Howe's misery by scoring with the spot-kick even though goalkeeper Gareth Stewart managed to get a hand to it.
The rest of the second half belonged to Oldham with Bournemouth clearly rattled by the setback.
Oldham hammered away and Liddell shot against the legs of Stewart before, in the 71st minute, Chris Porter perpetrated the miss of the match.
With Stewart stranded on the touchline, Porter had the whole of the goal to aim at, but lifted his shot wide when a goal looked inevitable.
Oldham drew level in the 79th minute when Liddell tried his luck from 25 yards and the ball went in off a post.
If any side was going to snatch a winner it was surely Oldham but, in the third minute of stoppage time, Bournemouth forced a rare corner.
It was taken on the right by Steven Foley-Sheridan and Oldham goalkeeper David Knight failed to hold on to the ball leaving Browning room to get in a left-foot shot for the winner.
It was a different story in the first half with James Hayter showing his quality with a stunning right-foot shot after 28 minutes to put Bournemouth ahead.
Hayter then scored his fourth of the season, with a perfectly executed downward header two minutes before half-time to put Bournemouth seemingly in control.