A list of Confederate prisoners at Johnson's Island, Ohio, published in Misc. Papers of the Virginia Historical Society lists Lt. A. H. Gray of Salisbury, NC as being captured on July 5, 1863. This would suggest he was wounded and/or captured at Gettysburg, most likely on July 2 during the assault of Hoke's NC brigade on Cemetery Hill. However, Lt. A. H. Gray appears as the Acting Adjutant of the regiment under a list of casualties from Gettysburg that was published in the Salisbury Watchman on 27 July 1863, which implies he came through that battle and remained on duty. Incidentally, Capt. Samuel Wiley Gray of Co. D (raised in Forsyth county) was killed at Gettysburg on July 2, but I don't know if the two men were related.