In the early stages of the American Revolutionary War Gregory was taken prisoner, but on 27 April 1776 he engineered his escape from Northampton, Massachusetts, with the future Admiral Hon. Sir Henry Edwyn Stanhope after the conditions of their parole had been altered. The two young officers were re-captured at Middleton in Connecticut within days to be imprisoned once more under close confinement at Northampton. At the time of this incident Gregory was described as 24 years-old. After being exchanged he was commissioned lieutenant on 10 May 1777.
On 26 August 1789 he was promoted commander of the fireship Vulcan 8 at Portsmouth, and he transferred from this vessel to the new sloop Serpent on 9 March 1790, fitting her out at Plymouth and sailing from that port on 27 June under sealed orders with ordnance and stores for Honduras via Barbados. Remaining thereafter on the Jamaican station, he was nevertheless one of the many officers posted captain on 22 November 1790 following the end of the Spanish Armament, being nominally appointed to the Grampus 50. It is likely that upon receiving confirmation of this promotion in the West Indies he left the Serpent in the spring of 1791 and returned to England.
In September 1792 he recommissioned the Europa 50 at Plymouth, and flying the broad pennant of Commodore John Ford he arrived at Jamaica from Portsmouth at the turn of 1793 after a seven week passage. Gregory remained with this vessel during operations over the next two years including the Saint-Domingue campaign in September, and at the capture of Port-au-Prince on 4 June 1794. He left her shortly afterwards to join the Penelope 32 when that frigate’s previous commander, Captain Bartholomew Rowley, was sent home with dispatches announcing the capture of Port-au-Prince. Remaining on the Jamaican station and being engaged in convoy duty, the Penelope carried troops to Saint-Domingue in July 1795, and she sailed for England with the West India convoy in the early part of 1796, with Gregory striking his pendant at Chatham at the beginning of May.
From July 1797 he commanded the Veteran 64, sailing out of Plymouth after a complete refit that month and arriving in the Downs on 5 August prior to departing the next day to join the North Sea fleet under Admiral Adam Duncan. This vessel fought at the Battle of Camperdown on 11 October, losing four men killed and twenty-one wounded, and with Gregory earning praise for the rescue of many British and Dutch sailors from the sinking Delft 68 at risk to his own ship. In December he attended the service of thanksgiving at St. Pauls where the captured colours of the enemy were paraded before the King. He retained the Veteran through to March of the following year, being attached to the North Sea squadron at Yarmouth.
Gregory did not see any further service but became a rear-admiral on 31 July 1810, and died at Portland Square, Bristol, on 24 January 1814.
At the time of his escape from American forces in 1776 he was described as having ‘light coloured short-hair, light complexion, thin-favoured, and about five feet eight inches high’. The address in his will was given as Bristol, Gloucestershire.