The Reds took full advantage of Birmingham’s shortcomings to secure a morale-boosting win, only their second in 12 games.
Birmingham generally struggled to contain the eager young Barnsley side and did themselves no favours when David Davis was sent off in the 71st minute for two yellow cards.
Birmingham failed to learn from Barnsley’s first goal in the 38th minute when Marc Roberts headed home a free-kick from captain Conor Hourihane.
Hourihane produced two further dead-ball crosses from which Sam Winnall was on hand to head home twice in the 84th and 86th minutes to take his tally to seven this season.
Heckingbottom said: “For the last two weeks we have been working really hard on set-pieces. It is important and it paid off against Birmingham.
“It is good from a coach’s point of view and when they get the reward it is very pleasing.
“We have only had one defeat in six games. We’ve only had two matches this season when we have not been in the game.
“This is the level of performance you need to be successful in the Championship. Sometimes you have to admit that is not good enough against some teams with the quality they possess. I thought it was a fine team effort.”
Birmingham City: Kuszczak, Dacres-Cogley, Morrison, Shotton, Grounds, Cotterill (Brown 72), Tesche, Kieftenbeld (Stewart 60), Davis, Jutkiewicz (Adams 60), Donaldson. Unused substitutes: Legzdins, Robinson, Gleeson, Solomon-Otabor.
Barnsley: Davies, Bree, Roberts, MacDonald, Yiadom, Scowen, Hourihane, Morsy (Hammill 89), Kent (Williams 85), Bradshaw, Winnall (Janko 89). Unused substitutes: Townsend, Evans, Kpekawa, Armstrong.
Referee: D Coote (Nottinghamshire).