Captain Frank B. Gurley
The case of Captain Frank B. Gurley, arrested in North Alabama in late 1863 for the killing of Union General McCook, was held in chains on and off until April of 1866. Convicted and sentenced to death for the murder on the grouds he was not a Confederate officer but a civilian, he languish in a Nashville jail until sent by mistake to Point Lookout and was paroled in March 1865. However he was re-arrested in November 1865 and put back in chains and held for immediate execution. Under the threat of an uprising in Huntsville, Alabama, with the resumption of killing Union soldiers, President Johnson delayed the execution until further notice. Since 1863, many people came forward to claim that Gurley was a legit commissioned officer in the Confederate Army, among them General N. B. Forrest, General J. E. Johnston, and General Hardee, all had written to Union officials stating so. He would survive being hung, eventually, but it took years of suffering in chains and locked in small cells to finally get free.
Below is the last orders found in the O.R. giving him his freedom.
"GENERAL WAR DEPARTMENT, COURT-MARTIAL ORDERS, ADJUTANT GENERALS OFFICE; No. 104. Washington, April 17, 1866. Frank B. Gurley, citizen, sentenced by a military commission to be hanged by the neck until he is dead, at such time and place as the general commanding may order, two-thirds of the members of the commission concurring in said sentence, as promulgated in General Court- Martial Orders, No. 505, War Department, Adjutant-Generals Office, September 6, 1865, upon the recommendation of Lieutenant-General Grant, is hereby released from confinement and will be placed upon his parole as a prisoner of war duly exchanged.
By order of the President of the United States: E. D. TOWNSEND, Assistant Adjutant- General."
Below is are links giving a summary of events, the O.R. has much more details about this case.