Barnet went ahead after 15 minutes with O'Flynn finishing from a tight angle after Cherries keeper Shwan Jalal had saved well from Albert Adomah.
O'Flynn should have doubled the Bees' advantage midway through the first half when he was put clean through by Micah Hyde, and Pitman made them pay on the stroke of half time after Barnet failed to clear Liam Feeney's cross.
Bournemouth went all-out for the winner after the break with Pitman forcing a smart save from Cole on the hour after latching onto substitute Steve Fletcher's knockdown.
The referee pointed to the spot after 75 minutes when Ahmed Deen's under-hit back pass forced Cole to bring down Pitman. But the home keeper made amends by brilliantly saving the ball down to his left.