This may be unrelated, but worth noting anyway... In the Dundonald Kirkyard, _Dundonald Monumental Inscriptions_,
Troon and District Family History Society, Troon:1994, there are three headstones in this order: Pettigrew; Dickie; Gray.
The first:
Erected by George
Pettigrew and Janet
Dickie his spouse to the memory of their daughter Mary, d. 6 Sept 1840 aged 17. The above mentioned George
Pettigrew d. 22 Nov 1865 aged 79. Janet
Dickie his wife d. 27 May 1868 aged 84.
The second:
[ ] John
Dickie [ ] William
Dickie, farmer in Highlee d. 14[ ]1792 aged 6. Also children [ ].
The third:
Erected by James gray, gardener at
Newfield in memory of his wife Margaret
Campbell Lockhard d. 21 Jun 1870 aged 45. Also of Robert his son d. in infancy.
Further along in the yard we find:
Erected by Andrew Gray in memory of his two sons viz. William d. 9 Dec 1800 aged 5 and James d. 6 July 1825 aged 22. Said Andrew Gray d. Tofts,
Tarbolton 27 Jan 1856 aged 67
(could this be your Andrew Gray?)
Two stones away:
Erected by James Gray in memory of his father John Gray d. at Old rome 26 Jul 1869 aged 62. His mother Margaret
Smith d. Carswell, Neilston 17 Mar 1889 aged 71.