Gifton Noel-Williams became only the second substitute in the history of Burnley Football Club to score a hat-trick.
The much-maligned striker replaced Alan Mahon 11 minutes before the half-time break as Burnley boss Steve Cotterill responded to a two-goal deficit.
The Clarets had started brightly with Jon Harley's cross from the left flicked on at the near post by Andy Gray and turned behind by goalkeeper Nick Colgan for a corner, from which John McGreal sent his header straight at Colgan.
Burnley's solid start continued as Steve Jones got to the by-line and pulled the ball back for Micah Hyde to test Colgan with a left-foot strike.
After surviving the early pressure, Barnsley almost went in front as a deflected shot from Tykes skipper Paul Reid was somehow kept out by the foot of keeper Brian Jensen.
The visitors took the lead on 21 minutes after Clarets skipper Wayne Thomas diverted a long ball into the path of Michael McIndoe, who confidently found the corner of the net with a fine left-foot finish.
McIndoe then extended Barnsley's lead as he seized on a mistake by Northern Ireland international defender Michael Duff and fired beyond the helpless Jensen.
Burnley pulled one back just prior to the interval as Harley's free-kick from 25 yards was deflected past Colgan.
The Barnsley keeper then ensured his side maintained their lead at half-time by saving well from a Noel-Williams header.
The second half started with Burnley again pressing hard and the inevitable equaliser arrived on 57 minutes as Noel-Williams headed home after a surging run down the right by Wade Elliott.
Martin Devaney then struck the underside of the crossbar with a fierce free-kick from 20 yards with Jensen helpless, while at the opposite end Colgan parried well from Jones at the expense of a corner.
Burnley went in front for the first time with seven minutes remaining after a quick free-kick involving Duff and Elliott. The Barnsley defence only cleared the ball as far as Micah Hyde who squared it for Noel-Williams to score off the underside of the bar.
Noel-Williams completed an amazing evening by registering his hat-trick in the 90th minute, diverting a shot from Hyde past Colgan with his head.