Junior Quitirna scored either side of Devante Cole’s first leveller before O’Keeffe’s last-gasp effort to earn a share of the spoils.
The visitors broke the deadlock in the third minute when Jack Marriott broke forward down the left, crossing to Quitirna who fired past of Ben Killip.
Barnsley were awarded a spot-kick four minutes later when Cole was brought down by Fleetwood goalkeeper Jay Lynch.
Cole himself stepped up and saw his penalty saved, but reacted quickly to score the rebound.
Lee Johnson’s side regained the lead in the 34th minute when Quitirna placed a 25-yard free-kick into the top-left corner.
Herbie Kane almost pulled his side level two minutes before the break. Receiving from Nicky Cadden, the midfielder struck the woodwork from the edge of the box as he aimed for the top-right corner.
Barnsley pushed for an equaliser and their pressure paid off two minutes from time when Kane’s cross found O’Keefe to head beyond Lynch.