Second-half strikes from on-loan striker Devante Cole and substitute Kane Hemmings sealed victory for the Tykes at Oakwell.
York defender Keith Lowe wasted the away side's best chance when he volleyed wide from close range six minutes prior to the interval while forward Michael Coulson curled an effort the wrong side of the left-hand upright early in the second period.
Wilson said: "The objective was to be in the hat. I think performances sometimes in the cup go out of the window when you see the result, but I have to say we found it very difficult, particularly in the first 45 minutes, I thought York played very, very well.
"They got us on our back foot and pressed us really well. They had a couple of good chances, maybe half-chances, but certainly they got in between us a few times, a few too many times for me and really we could have been one or two behind.
"Second half we were more like ourselves, we got on the front foot. I think we passed the ball better and retained the ball better, certainly up the top.
"We've got the threat in the team and as the game wore on I thought we might get one or two more but listen, if it had been one-nil here I'd have settled for it because these are potential banana skins for us."
York manager Nigel Worthington was happy with his side's display despite the loss.
"I'm feeling very good, I thought it was an excellent performance," he said. "I thought the way we knocked the ball about and took Barnsley on at their place was very, very good.
"There were two little bits for the goals; it was a good strike for the second, we should have dealt with the first one better but apart from that, the energy, the commitment, the quality at times was excellent.
"A lot of crosses came in from either side and some of the quality was decent but at times it could have been better but it was a lot more positive from that point of view.
"We've had chances; people coming into the box, people on the edge of the box, that's just about believing and going and hitting the target. The lad for Barnsley with the second goal (Hemmings) just shows you if you can line one up they can fly into the back of the net."