In 1864 Wharton participated in the Overland Campaign, fighting in Breckinridge's division during the Confederate victory at Battle of Cold Harbor from May 31 – June 12. His brigade also participated in the Battle of Monocacy on July 9. Wharton was part of Lt. Gen. Jubal Early's operations in his Valley Campaigns, and he participated in the Confederate defeat at the Battle of Cedar Creek on October 19. He also fought in the Battle of Waynesboro, Virginia on March 2, 1865, at the end of which his command was largely dispersed and Early's army virtually destroyed. Wharton led what was left of his division until May 2. He was paroled at the end of the war from Lynchburg, Virginia, on June 4.