In 1861, he left the Democratic party, and was reelected to the state senate as an Independent and supported the Republican governor throughout the war. Governor Oliver P. Morton had a stroke in 1865, and traveled to Europe for treatment and Conrad Baker became acting governor. Dunning was then elected president pro tempore of the senate to fill Baker's place. Dunning's wife died in 1863 and Dunning remarried to the widow of Allen Ashford on September 17, 1865. When his term in the Senate ended in 1867, he was nominated to run again, but declined. He declined a second offer to run for Congress in 1868, preferring to remain in his law practice. Dunning gained a national reputation as a lawyer, and was committed to criminal law. His reputation was such that his clients were "assured of success when he was on the case."