In 1848-1855 he lived in Tiflis serving under Mikhail Semyonovich Vorontsov. Among the military and administrative duties, Gagarin did a lot of works for the city. He built a theater there, frescoed the Tbilisi Sioni Cathedral, and restored frescoes of the old Georgian cathedrals, including the Betania monastery. By this time were born the first children from his second marriage: Prince Grigory in 1850; Princess Mariya (Tiflis, 14 June 1851 - Cannes, 2 August 1941), from whose marriage with Mikhail Nikolaievich Raievsky (1841–1893) she had beside seven other children Irina Mikhailovna Raievskaya, the morganatic wife of George, Duke of Mecklenburg; and Princess Anastasia in 1853.