The 31-year-old, at his hometown club on a season-long loan from Manchester City, fired Cardiff ahead shortly before half-time in his first appearance back from a five-game absence due to knee trouble.
Bellamy's second goal of the season was a rare moment of quality during an uneventful first half, but the game ignited after the break, with Jason Shackell equalising for Barnsley in the 63rd minute, home goalkeeper Luke Steele saving Peter Whittingham's penalty and Seyi Olofinjana firing the visitors' winner.
Cardiff midfielder Darcy Blake was sent-off in the 82nd minute for a rash challenge that warranted a second yellow card and visiting goalkeeper Tom Heaton pulled off a fine save to deny Barnsley winger Adam Hammill in the 88th minute, but Dave Jones' side held on.
Barnsley made five changes with on-loan strikers Garry O'Connor and Chris Wood, Jay McEveley, Kieran Trippier and Hugo Colace all returning, while Bellamy and Gabor Gyepes were back for Cardiff.
Whittingham curled an early long-range free-kick over the crossbar for the Bluebirds, but there were limited chances early in the first half.
Barnsley's only efforts on goal in the opening 20 minutes were two 25-yard shots from Diego Arismendi, the second blocked by visiting defender Mark Hudson.
Barnsley went closer to lighting up a poor spectacle when O'Connor headed Trippier's 33rd-minute free-kick narrowly wide.
But it was Cardiff who broke the deadlock three minutes before the interval with a rare moment of class.
Whittingham, who expertly controlled a raking cross-field pass, laid off the ball to Bellamy on the edge of the penalty area and the Wales international deftly slipped the ball into the bottom corner beyond Steele.
Cardiff thought they had scored a second soon after the break, but Gyepes' goalbound header from a corner was flicked over the goalline by Jay Bothroyd and the Cardiff striker was deemed offside by Berkshire referee Trevor Kettle.
Barnsley then hauled themselves level soon after when Shackell rammed home his second goal of the season after Jim O'Brien's corner fell kindly for him in the area.
Cardiff squandered the chance to regain the lead seconds after the restart.
Barnsley skipper Stephen Foster handled Whittingham's corner, but the Cardiff midfielder then saw Steele save his subsequent penalty, which was blasted straight at the Tykes goalkeeper.
But the Welshmen went back in front 60 seconds later when Whittingham's shot following Bellamy's corner was turned home by Olofinjana from close range.
Olofinjana headed against the post in the 70th minute from another Whittingham corner and although Darcy was dismissed in the 82nd minute after his challenge on Hammill had earned him a second booking, the home side only threatened to get back on terms when Hammill's late shot forced Heaton into a fine save.