Grays came back from two goals down in this opene and entertaining Nationwide Conference clash at the KitKat Crescent, but they travelled back down the A1 think of what might have been, Blues midfielder John Martin hit the woodwork in the fifth minute of injury time and the visitors also missed a penalty in the early stages.
During an incident-packed first 15 minutes of the match, three goals were scored and Grays squandered their chance from the spot.
City began the game in the ascendancy with Craig Farrell holding the ball up excellently as the Essex club struggled to cope with the slick passing and fluid movement of the home side's five-man midfield.
Billy McEwan's men took a fifth-minute lead when Anthony Lloyd's cross from the left was nodded expertly down by Farrell into the path of Steve Bowey, who beat Grays keeper Danny Knowles with a low 12-yard drive into his bottom left-hand corner. It was a tough start for former Gillingham player Knowles, given his chance in place of Ashley Bayes who dropped to the bench as he wasn't fully fit.
Bowey then drove narrowly wide from 25 yards and Farrell swept a chance just past the post as City made a highly-impressive start.
But the first warning that Grays had not just travelled north to make up the numbers came on ten minutes when City skipper Emmanuel Panther's clumsy challenge on Ashley Nicholls, who was heading away from goal and out of the penalty box, led to a spot kick.
Glenn Poole, though, lofted his effort well over Tom Evans' bar and City looked to have survived the scare when they doubled their advantage three minutes later with Lewis McMahon's first senior goal for the club.
The former Sheffield Wednesday midfielder thundered a 25-yard, first-time half-volley into Knowles' bottom right-hand corner to open his account in style after Gavin Cowan's headed clearance from a Lloyd cross.
Grays, however, reduced the deficit on 15 minutes when Bowey was penalised for a tackle on the edge of the box and Poole proved more deadly from 20 yards than 12 when his low free kick found the back of the net after bouncing over the dive of Evans.
Cowan then headed over from a Poole corner but City finished the half strongest with Bowey shooting wide on the turn after another raid down the left by Lloyd and David McGurk forcing a save by Knowles from his 38th-minute header.
The Minstermen, however, appeared to lose their way in the second period although Bowey could have made the game safe on 64 minutes when a fortuitous ricochet off Farrell left him with only Knowles to beat but he dragged the chance across the face of goal and wide.
Grays capitalised fully with Martin robbing a dallying McMahon of possession 25 yards from goal before feeding on-loan MK Dons striker Ben Harding, who rode a challenge from home substitute Nathan Peat and drilled a low ten-yard shot into Evans' bottom left-hand corner.
Maximum points were then up for grabs with Farrell bending a 30-yard effort just past Knowles' top left-hand corner and Panther rising unchallenged to head wide from a Woolford corner. But Grays came closest to snatching victory when Martin headed against the frame following a Nicholls cross.
It was an extraordinary end to a game in which City had looked so dominant at the start. Grays, though, are now unbeaten in five matches with the Minstermen and manager Justin Edinburgh will hope this match can be used as a springboard for a climb back up the table.
Despondent York City boss Billy McEwan lamented the standard of Conference refereeing after watching his side surrender a two-goal advantage in Saturday's 2-2 home draw with Grays Athletic.
Ilkley official Paul Varley awarded Grays a disputed free kick that provided Glenn Poole with the opportunity to pull the first goal back for the visitors and on-loan MK Dons forward Ben Harding then struck on 77 minutes to cancel out Steve Bowey and Lewis McMahon's earlier efforts and earn the Essex club a share of the spoils.
McEwan was left seething by Varley's performance afterwards following on from refereeing displays he also perecived as poor in City's previous two outings at Halifax and Kidderminster.
The frustrated City boss said: "The refereeing was absolutely frightening. I'm disappointed and fed up with the referees at this level.
"He was crap. There's no other word for it."
"Every time the crowd shouted he gave decisions and it was weak refereeing. It's about time it's sorted out because we are saying it every week..
"It's absolutely scandalous and it's driving me nuts. The free kick decision was harsh although I'm disappointed with how it went in with the wall and one or two other things."
McEwan was less scathing about his side letting a two-goal lead slip..
Goalscorer McMahon lost the ball 25 yards from his own goal to present Harding with the chance to equalise but McEwan was careful not to be too critical, putting his side's inability to hold on to their early advantage down to naivety.
He said: "There are areas where you play football and areas where you don't in your defensive third and that's what we did but I can't be too critical of my players because they are only babies. They are 21 and 22-year-olds but that's my decision. I've got to take responsibility for that but I know they will develop and be all right.
"The opening 20 or 25 minutes was also the best football I have seen from the team since I have been in charge. Some of the movement and attacking play was absolutely fantastic.
"We took our foot off the pedal when we were 2-0 up. We then got careless, sloppy and panicked.
"I thought the boys were outstanding with their effort and commitment but some of them are naive and will make rash decisions and get punished. Grays also deserve credit though as they changed things and adjusted because they feared they might get beaten by five or six and caused us problems."
City lost a concussed Danny Parslow midway through the second half before Grays equalised but, despite being strecthered off after collapsing and receiving five minutes of attention from both physios and club doctor Robert Porter, McEwan believes the former Welsh under-21 international has made a full recovery.
He said: "He was up and about after the match. It was a worry when he went down as he was staggering about so we will keep an eye on him and check it out.
"He got kicked in the head but these things happen in a battle."
McEwan also bemoaned the condition of the KitKat Crescent pitch and the suspension of Clayton Donaldson, who was serving the second game of his three-match ban.
He said: "The pitch is like a cabbage patch. It was not condusive to either side trying to play football. We did well at times but, on the wings, players were sinking three of four inches into the turf.
"We also had our top scorer sat in the stand and he should be hurting because we were without him which is no good to anybody because I believe he would have got a couple of goals."
Thanks to the Thurrock Gazette for the report.