Ogle was elected as a Whig to the Thirty-first Congress. He was an unsuccessful candidate for reelection in 1850. He was appointed United States Chargé d'Affaires to Denmark on January 22, 1852, but did not assume his duties at that post. He died in Somerset in 1852. Interment in Union Cemetery.