From zero to writing hero
Years later, he is an award-winning children's author, thanks to books such as Warehouse, Malarkey and The Fearful.
Yet Mr Gray did not read a "proper" book until the age of 12, was an average student at school, and stumbled into his ill-fated business and finance diploma having failed to get the grades for an English degree.
He will be at Glasgow's Aye Write! festival today to explain how he overcame early difficulties with reading to become a writer.
"All the way through primary school, I was classed as a reluctant reader,"
said Mr Gray, who lives in Edinburgh but grew up in Grimsby in Lincolnshire.
His parents did not read - to this day the only books in their home are those written by their son - and school made reading a chore. He was not inspired by books on the curriculum or the way they were taught; even today, he cannot bear to pick up D H Lawrence or Thomas Hardy. "The only reading I did was because there was a test or exam at the end," he says.
"School didn't teach me that books were entertainment."
Mr Gray's enjoyment of reading began with The Beano and The Dandy, before he graduated onto darker comics with characters such as Judge Dredd and Batman.
At 12 Mr Gray read his first "proper" book, Robert Westall's The Machine Gunners, recommended by a schoolmate. "I read it because I wanted to be his friend."
He then developed a passion for Stephen King, largely, he believes, because admiration of the horror novelist's ghoulish stories was an act of rebellion. By 14, he was writing stories in his spare time and operating a lucrative sideline in completing classmates' homework: he charged pound;2 for an A grade, pound;1.50 for a B and pound;1 for a C.
Now 35, Mr Gray feels that the key to getting children interested in reading is to begin with books that appeal to younger readers, saving weighty classics for later. "I'm a big believer in starting small and building bigger."
He believes Shakespeare could become more appealing if treated as a "reward", perhaps by introducing his work in creative writing classes. Mr Gray reasons that pupils, themselves searching for that elusive phrase, could empathise with the effort required for memorable writing. "You should read Shakespeare to get that big, emotional kick, to love the heroes, to hate the villains, to wait for good to prevail - not to get an A, B or C grade.
"You could have somebody get to the end of Romeo and Juliet and sit in tears, crying, but not quite able to jump through the educational hoops.
And that's such a pity."