Gillingham 2 (Samuel 25, Dack 63)
Reds 1 (Hourihane 62)
Barnsley's fantastic seven-match-winning run came to an end at highflying Gillingham following a slightly unfortunate 2-1 defeat.
A mad two minutes in the second half saw the Reds restore parity only for the hosts to pull clear again less than 60 seconds after Hourihane's leveller.
The hosts created the first opportunity on just three minutes after some neat interchange play down the left. A deep delivery landed on the head of Donnelly but he ballooned his effort high over the crossbar.
The Reds responded three minutes later through Marley Watkins who showed quick feet to work his way into the area and he managed to test Nelson with a low drive from a tight angle but Nelson grabbed at the second attempt.
Conor Hourihane whipped in a dangerous free-kick from the right on eight minutes with Long seeing a header cleared for a corner. At the other end moments later, a similar delivery by Dack drew an offside flag on Dominic Samuel.
A vicious low effort from Adam Hammill from 35 yards after a quick free-kick by Hourihane had to be turned round the post by Nelson for a corner.
The hosts broke the deadlock from nowhere after capitalising on a poor pass by Bree. Samuel latched onto the ball, raced past Long and tucked home in at the near post.
It was a disappointing goal to concede considering Bree had started so well and the Reds had look generally solid.
Watkins was working hard to try bring his side some luck in the final third but just as he went to deliver for Winnall, the ball hit a bobble which meant his cross was easily caught by Nelson.
Gillingham weren't giving the Reds any time on the ball as they hustled and harried at every opportunity.
The Reds started brightly in the second half and forced two corners in quick succession after Long saw his header blocked wide. The centre-half then went down after taking a late knock to the head in the box with his team mates claiming a penalty.
On 53 minutes it could have been 2-0 as Bradley Dack beat the offside trap as he raced into the box but his pull-back was blazed wide by Samuel from barely seven yards.
Paul Heckingbottom threw the dice with two changes as Ashley Fletcher and Josh Scowen replaced Lloyd Isgrove and Josh Brownhill.
Barnsley were back in it on 62 minutes as Conor Hourihane hauled his side level. A quick throw from White landed perfectly for Hourihane to half-volley into the far corner - the midfielder showed great technique to curl it beyond Nelson.
The home side came straight at the Reds and restored the lead within a minute. Donnelly charged down the right and despite the tightening angle, he forced a save from Davies with Dack following up to smash home into an empty net.
Ashley Fletcher took advantage of the home side's inability to clear the ball but couldn't direct his volley on target with his effort dropping well wide from the edge of the box.
The Reds were battling hard to try and create another opening but Gillingham were standing strong and threatening on the counter.
Adam Hammill was put clean through but down the left channel as the clock ticked over 87 minutes. His left-footed delivery found Winnall but he was blocked by Egan's back.
In the third minute of five added, Conor Hourihane fizzed a low strike in from 25 yards that took a nick off Loft and scraped the outside of the post.
Gillingham were camped in their own box for the last 10 minutes with the Reds struggling to find a way through - Josh Scowen heading wide for Barnsley's last chance as a brilliant run of league victories came to an end.
Gillingham: Nelson, A. Morris, Egan, Ehmer, Garmston (Chicksen 64), Osadebe (McGlashan 85), Wright, Loft, Dack, Samuel, Donnelly.
Subs: G. Morris, Hessenthaler, List, Williams, Norris.
Reds: Davies, Bree, White, Mawson, Long, Hourihane, Brownhill (Scowen 61), Isgrove (Fletcher 61), Hammill, Watkins (Khan 85), Winnall.
Subs: Townsend, G.Williams, Tuton, Roberts.