Not being picky or anything but, for the last child of John gray to be 20 months old in the 1851 census, he/she could not have been born any earlier than July 1849. :wink:
Just a minor detail like that is quite capable of taking you off on the wrong line of enquiry, especially if there was more than one John Gray for whom a child's birth was registered between 1848 and July 1849.
That said, I am finding nothing relating to his death, but it can be tied down to somewhere between October 1848 and March 1851. The reasoning between those two dates are:
1) a full-term baby would have been conceived in October 1848 if 20 months old at the 1851 census.
2) The 1851 census was relevant to those staying at a known address overnight 30th to 31st March.
As civil registration in Scotland did not begin until 1855, it will be necessary for you to check the Parish Registers for the district. Hopefully, your local reference library may be able to get them for you if they are on microfilm.
Sorry I can't help further.
keith.