September 16, the regiment helped lead Brigadier General Joseph Hooker's corps across Antietam Creek and Company H was assigned to Hooker's headquarters. The following afternoon, as Confederate Lieutenant General Stonewall Jackson was pushing towards the Union line, one of his brigades rushed forward on a Union gun battery. Miller came to the aid of the battery and helped rescue guns before they fell to the enemy, and for his gallantry was promoted to captain for his efforts and bravery. With his promotion to captain, Miller became the commander of Company H. Gettysburg On July 2, 1863, the 3rd Pennsylvania Cavalry arrived at Brinkerhoff's Ridge to the east of Gettysburg, Pennsylvania. Miller's company, totaling roughly 100 troops, assumed a position on the right flank of the Union line near Cress Run which they held for the rest of the day. In the evening, Miller's Company H pushed forward with Company M to slow the advance of the 2nd Virginia Cavalry along the ridge. This prevented the Confederate army from fully fortifying the later attack on Culp's Hill as it would have left their flank uncovered. On July 3, Miller was given orders to hold his company "at all hazards" in the woods north of the Lott house and assist the 1st New Jersey Cavalry Regiment in repelling Brigadier General Wade Hampton's advance. When the enemy brigade advanced, Miller noticed a large contingent led by Confederate Brigadier General Fitzhugh Lee threatening to break through a main section of the Union line. From his flank position he decided to disobey his orders and attack the Confederate from the side and stated to his adjutants, "I have been ordered to hold this position, but, if you will back me up in case I am court-martialed for disobedience, I will order a charge." With full company agreement, Miller led his men into the flank of the Confederate advance causing confusion among the rebels who believed their retreat path was about to be cut off. Because of Miller's surprise attack, the Confederate rear line was dispersed, and the Union line saved. During the melee, Miller was shot through the right arm. After the fighting, Colonel John Baillie McIntosh, who had attacked the Confederate charge from the opposite flank, congratulated Miller on his attack. Miller fought with the Union army for another year before being mustered out of service on August 24, 1864. Despite disobeying a direct