After the start of the Civil War, Gamble was appointed Lieutenant Colonel of the 8th Illinois Cavalry regiment on 18 September 1861. His nomination was urged by his close friend, U.S. Congressman John F. Farnsworth, who raised and commanded the regiment. Gamble's son George also joined the regiment as a first lieutenant.. Gamble's regiment was attached to the Pennsylvania Reserve Division and fought in the Peninsula Campaign, where he was wounded in the chest, leading a cavalry charge against rebel pickets more than a month after the end of the Seven Days Battles. After recovering from his wound, Gamble was promoted to colonel on 5 December 1862, just before the Battle of Fredericksburg, but his regiment saw no action in that fight. When Farnsworth was promoted, Gamble was given command of the 8th Illinois Cavalry. In the spring of 1863, he was promoted to command of the 1st Brigade of Maj. Gen. Alfred Pleasonton's cavalry division in the Army of the Potomac, but he was away from the Army on medical leave during the Battle of Chancellorsville. During the Gettysburg Campaign, Gamble continued on leave and missed the largest predominantly cavalry battle of the war, Brandy Station. The officer in temporary command of his brigade, Colonel Benjamin Franklin Davis, was killed there, and Gamble returned to the field on 13 June 1863. His brigade was assigned to Brig. Gen. John Buford's 1st Division. He reached Gettysburg on 30 June and was riding at the head of the column when they spotted the first elements of the Confederate Army of Northern Virginia and began the Battle of Gettysburg on the morning of 1 July. While his troops were hopelessly outnumbered, they slowed the progress of the Mississippi brigades from Lt. Gen. A.P. Hill's corps for about two hours while Union infantry from Maj. Gen. John F. Reynolds's I Corps hurried to join the fight. When it came time to retire, Colonel Gamble's troops moved to the infantry's left flank. Gamble, along with the rest of Buford's cavalry, had provided a crucial window of time to get the Union Army into position. Later in 1863, Gamble commanded a cavalry division in the XXII Corps of the Department of Washington for the remainder of the war. He was involved in the defenses of Washington, D.C., and his troopers also tangled with the Confederatepartisan ranger, John S. Mosby. He commanded the remount station at Camp Stoneman, but the lingering effects of his wounds prevented any further field service. Gamble received a brevet promotion to brigadier general on 12 December 1864, and a full promotion to brigadier general on 25 September 1865. He was mustered out of the volunteer service on 13 March 1866, and reentered the service with the rank of major in the 8th U.S. Cavalry.
Postbellum life
Gamble died of cholera in Virgin Bay, Nicaragua, while en route to command of the Presidio of San Francisco, and is buried in Virgin Bay in the Virgin Grove Cemetery, a burial ground which has been flooded and obliterated by the waters of the Bay.