Bournemouth had chances of their own with Andrew Surman missing the target from a good position and the woodwork coming to the home's rescue late on to deny Matt Ritchie. Home goalkeeper Luke Steele also made some good saves before Cook scored.
Barnsley, who previously suffered back-to-back defeats, made an encouraging start.
Striker Chris O'Grady threatened to score inside the opening minute of the match when he directed a header on target, but the effort was easily saved by Lee Camp.
After Bournemouth's Ryan Fraser tried a 20-yard shot which was kept out by Steele, the home side enjoyed a good spell, without testing Camp.
O'Grady was off target with a volley, then Pedersen just failed to get on the end of a cross from Ryan McLaughlin before the ball was cleared for a corner.
As Barnsley continued to press, Dale Jennings tried an effort from long-range which was deflected over.
Bournemouth responded with Ritchie firing in a 30-yard drive which was turned wide by Steele and the keeper was also called into action to keep out a shot from Fraser.
The visitors had a chance to open the scoring just before the half-hour mark when Surman was through on goal following a neat pass from Yann Kermorgant - but he shot wide.
Barnsley had an even better opening a few minutes later when Woods' shot failed to find the unguarded net after Camp's punch out towards the edge of his area saw the ball fall at the midfielder's feet.
At the end of the half, Lewis Grabban's fierce, angled shot forced a good save from Steele.
Pedersen was in the thick of the action soon after the restart, having a header comfortably saved by Camp and then slicing a shot wide from inside the area.
Bournemouth's Grabban then shot wide while Fraser put an effort straight at Steele.
Barnsley substitute Tomasz Cywka had a free-kick blocked by the defensive wall before Pedersen wasted another good opening, firing off-target from inside the area following O'Grady's lay-off in a counter-attack.
Ritchie was unlucky to see the ball come back off the bar after beating Steele with a fine strike from distance.
Bournemouth skipper Tommy Elphick then had a header saved by the Barnsley keeper.
With just a few minutes remaining, Steele also did well to keep out Ritchie's close-range shot before Cook struck deep into stoppage time.
His initial effort following a corner was blocked but he followed up to turn home the rebound.
The result leaves Barnsley anchored to the foot of the Championship table.
- Sports & Recreation
- Luke Steele
- Matt Ritchie
- Marcus Pedersen
- Andrew Surman
- Ryan Fraser
- Martin Woods