Sheffield Wednesday midfielder Chris Brunt snatched an injury-time winner to leave Andy Ritchie's Barnsley side still looking for their first derby victory at Hillsborough for 23 years.
The 21-year-old midfielder produced a spectacular long-range strike from 20yards after the battling ten-man Tykes threatened to overrun Wednesday in a thrilling South Yorkshire showdown.
Wednesday swept ahead with a stunning goal on four minutes after Brian Howard had upended Wade Small. Free-kick specialist Brunt ran over the ball and Glenn Whelan stepped up to finish with a crisp strike, tucking it into the bottom right-hand corner from 22 yards.
Barnsley were almost level four minutes later, Michael McIndoe finding space on the left flank before picking out Paul Hayes, whose header was tipped on to the bar by Brad Jones before the ball was hammered clear.
Wednesday were carved open again with the lively McIndoe again involved. His delicate pass fell perfectly for midfielder Howard who finished with an eye-catching volley, the ball flashing over the target from 15 yards.
The Oakwell side were down to ten men in the 25th minute, ex-Wednesday defender Paul Heckingbottom was red-carded for a rash challenge on Small after being booked earlier on for handball.
But they still add the upper hand. Martin Devaney almost found a way through with a curling right-foot shot towards the top corner, palmed away by Jones, while Marc Richards saw his shot curl the wrong side of the bar as Wednesday panicked again.
The Sheffield side almost snatched a second minutes after the re-start, as Nick Colgan challenged Small on the edge of his area. The ball fell to Brunt whose stinging shot took a slight deflection and ripped into the side-netting.
Barnsley drew level in the 57th minute after Jones could only block Richards' shot and the lurking Howard pounced to stab the ball in from 16 yards.
Substitute Daniel Nardiello should have grabbed the winner eight minutes from time but pulled his shot wide.
And with the seconds ticking away, Brunt had the last word to give Wednesday their first home win of the season and send most of the Hillsborough crowd into raptures.