The 25-year-old told BBC Radio York: "The gaffer has plugged away and he said to us 'don't get disheartened - it's going to come.'
"We looked solid at the back and we scored a few goals which is a boost for the boys."
He added: "The performances have been there it's just we've been lacking goals and letting silly goals in."
Before the FA Cup tie Rankine had scored seven goals in 17 games.
"It's always good to score a goal. I've scored a couple of penalties and I was wondering when one was going to come in open play but I got it.
"The boys have worked tremendously hard. We've had a couple of games in a couple of days but we're all pulling through and everything's good. It's down to the boys. Brilliant service."
York City will travel to Darlington in the second round.
Source: BBC Sport