Conor Hourihane scored an incredible 88th-minute winner as Barnsley began 2017 with a 1-0 success at Nottingham Forest.
The Reds skipper found the top left corner from 30 yards to put his side up to eighth in the Championship, only four points off the play-offs.
Paul Heckingbottom made four changes from the side that drew with Birmimgham City just two days earlier, as he tried to use fresh legs against a Forest side who had played a day before their visitors so had more recovery time.
Sam Morsy came out of the squad after Wigan recalled him from his loan. The Reds have now made a permanent offer of the amount agreed in his original loan deal.
Top-scorer Sam Winnall and second top-scorer Marley Watkins were both dropped to the bench and replaced by Ryan Williams and Josh Scowen, while Adam Jackson came in for the suspended Marc Roberts.
The Reds began brightly and, after Hammill forced a good save from a 25-yard free-kick, his corner should have been turned in by Scowen who blazed over from two yards out at the back post.
Hammill continued to impress with his set pieces as a free-kick was headed straight at Forest goalkeeper Stephen Henderson by Tom Bradshaw, who was playing on his own up front in a 4-5-1 formation.
Britt Assombalonga had Forest's first real chance midway through the first half when he headed Ben Osborn's corner just wide of the top right corner.
Another Hammill corner created another great chance for Scowen as he was unmarked at the back post but his volley from six yards out was well saved by Henderson then the rebound was deflected over by a defender.
The Reds had the better of the first half overall and will have been disappointed to go back into the dressing room not winning by at least one goal.
Heckingbottom brought Watkins on at half-time for Ryan Kent, who had been very quiet on the right wing.
Forest began the second half well as captain Eric Lichaj headed over a cross by Dan Osborn who then sent in another delivery which Jack Hobbs nodded against the crossbar.
Hammill and James Bree failed to test Henderson from 25 yards but Barnsley grew back into the match after being on the back foot early in the second half.
Former Arsenal striker Nicklas Bendtner came on and scored what looked like the winner, with a good turn and finish, before the home crowd's delight was cut short by the linesman's flag.
It was the noisy away end who were celebrating when Hourihane smashed the ball into the top left corner after it sat up nicely for him 30 yards out.