From 1797, he served in the Provisional Expedition of the College of War in St. Petersburg and was promoted to major general.
At the end of 1802, under the patronage of Gavrila Derzhavin (then Minister of Justice), he was appointed chief overseer of the Crimean salt lakes.
In 1817, he was appointed senator to Moscow; in 1818, under the personal order of Emperor Alexander I, he headed a senatorial audit investigating abuses committed by the administrations of Vladimir, Astrakhan, and Caucasus provinces.
In the last years of his life, he maintained close relations with the Archbishop of Moscow and Kolomna Philaret Drozdov.
From 1807, at the insistence of Derzhavin, Mertvago began working on the "Notes" in which he described the events of the Pugachev's Rebellion, the reign of Emperor Paul I, and he gave portraits of prominent statesmen of the late 18th – early 19th centuries.