Elliot Benyon fired the Gulls ahead after just six minutes, spinning on Jordan Chapell's shot to beat City goalkeeper Michael Ingham from 10 yards.
Ingham could do nothing about Ryan Jarvis' winner, a thumping 20-yard drive into the top corner after 23 minutes.
York striker Richard Cresswell reduced the arrears with a 73rd-minute penalty after Torquay left-back, and last man, Thomas Cruise was sent-off for denying Josh Carson a goalscoring opportunity, but it was too little, too late for the Minstermen.
It was 19th-placed Torquay's second 2-1 home win in five days and moved them five points clear of second-bottom York with six games remaining.
Knill said: "It wasn't pretty but it is all about the points. It was frantic at the end but great that we took another three points. It's a great win to cap off a great week for us."
Knill added: "I was delighted for Elliot, the only thing that has been missing for him was a goal because he does a lot of work and a lot of running and his commitment is fantastic and he just needed a goal - and there it was. His finishing was clinical.
"It's a great start. Ryan is a clever player and we allow him some freedom, to go in. From where I was looking I thought it hit the side netting because the 'keeper never moved. All of a sudden people started cheering and you realise it was a goal, a great goal.
"I must admit I didn't think we played great but we did enough to win the game and that's what it's about. You can't play great every week, you have to win the game and we are starting to do that.
"We had to dig in at the end again and again fantastic from the players they did the right things, dug-in, and saw out the game."