Marley Watkins had headed the hosts in front on 21 minutes before City turned things around through second-half goals from Lee Tomlin (penalty) and Tammy Abraham. Barnsley’s Sam Winnall also missed a spot-kick in first-half stoppage time.
With time running out, substitute Hammill cut in from the left and found the far corner of the net with a perfectly executed shot.
Heckingbottom said: “It would have been a travesty if we hadn’t got anything out of it, but when you’ve been behind and you score a late goal, you’re satisfied with a point.
“There were lots of pleasing things and we’ll look back and think we should have won the game.
“The game could have been easy for us and then you’re 2-1 down and you’re scrambling to get a point and we managed to do it. The character of the lads is fantastic and, from the first minute to the last, they were great. Even in the build-up, helping Josh Kay through his debut.
“We had a lot of players missing but to a man they were fantastic. It just shows the value of all the squad. He (Hammill) has got great talent and if you want anyone in that position with the ball, it’s Adam Hammill. Luckily for us, he scored.”
Bristol City boss Lee Johnson was not happy to see his side concede at the death, but acknowledged a draw was a fair outcome against his former club.
He said: “It was a rollercoaster for me, that’s for sure. I’m disappointed to have not got the three points, but in fairness on the balance of play, a draw was probably a fair result.
“I have to look from the technical side of how we went from a throw-in in the top left-hand corner, with three minutes to go, to conceding 25 seconds later.
“It was end to end with lots of incidents. I thought the referee liked the sound of his own whistle in the first half. That was driving me a bit mad.
“Adam Davies pulled off an absolute worldy from Aaron Wilbraham and both keepers have had to keep their teams in the game. I was pleased with the first half but disappointed with the second half.
“It was an exciting game for people to watch.”
Barnsley: Davies, Bree, MacDonald, Jackson, Yiadom, Watkins (Hammill 76), Morsy, Kay (Williams 88), Kent, Winnall, Armstrong Unused substitutes: Lee, Townsend, Evans, Kpekawa, Bradshaw
Bristol City: Fielding, Matthews (Brownhill 80), Flint, Magnusson, Golbourne (Bryan 66), O’Neil, Reid (Moore 66), Smith, Tomlin, Wilbraham, Abraham. Unused substitutes: O’Donnell, Engvall, Paterson, Pack.
Referee: Geoff Eltringham (Tyne & Wear).