BARNSLEY left it late to beat National League side York City 3-2 in the first round of the FA Cup.
Josh Stones opened the scoring for York before Davis Keillor-Dunn levelled for the Reds the half-hour mark.
The Reds' striker then put the Reds 2-1 in front in the 77th minute before Mark Kitching levelled the game for York two minutes from time.
But centre-back Marc Roberts won the game in the 92nd minute thanks to a great header from a Connell corner.
Conor Hourihane made two changes to his side that lost 1-0 at home to Rotherham a week ago.
Jon Russell and Neil Farrugia both came into the starting line-up, with David McGoldrick dropping to the bench and Mael de Gevigney completely out of the squad.
The Minsterman were backed by a huge away following and started the game the stronger of the two sides.
Josh Stones, the former Wigan striker, would have been clean through on goal - after nicking the ball past Marc Roberts - had it not been for Jonathan Bland recovering.
Stones came even closer on 12 minutes as he found space in the box after combining with Ollie Banks but Murphy Cooper did incredibly well to narrow the angle and push the ball clear.
He finally got his goal in the 24th minute, combining again with Banks but this time his header was on target and Cooper could do nothing about it.
Barnsley equalised seven minutes later as Russell found some space in the box before laying off Davis Keillor-Dunn who made no mistake to score his seventh goal of the season.
Hourihane replaced Nathanael Ogbeta with Tennai Watson straight after the goal and moved into a 3-5-2 formation - one his side looked much more comfortable in.
Cleary almost put the Reds in front on the stroke of half-time but his magical curling effort was tipped just wide of the post by Harrison Male.
The Reds started the second half the stronger and came close with a Marc Roberts header five minutes after the break.
Ollie Banks should have given his side the lead on 57 minutes after Stones played him through on goal, but he shot straight at Cooper who made the save.
Jonathan Bland cleared a Joe Felix shot off the line in the 63rd minute before the away side had three chances to put the ball in the back of the net, only for it to be put over the bar.
Keillor-Dunn gave Barnsley the lead in the 77th minute as he smartly turned home from inside the area after being found by Neil Farrugia.
There were calls for an offside flag fro the York players but they were waved away.
Mark Kitching blasted the ball into the roof of the net to level the game for York in the 88th minute after Alex Newby's free-kick was parried away by the Barnsley goalkeeper.
But the National League side were denied in the second minute of added time after Marc Roberts climbed highest from a corner to give the Reds a 3-2 victory.