Ekrem Imamoglu of the main opposition Republican People's Party (CHP), who won in the June re-run of the Istanbul vote, called Ankara's move an act of "carelessness".
Imamoglu's visit was the latest sign of warming relations between the CHP and the pro-Kurdish Peoples' Democratic Party (HDP).
The mayors of the eastern cities of Diyarbakir, Mardin and Van - all HDP members elected in March - were sacked on August 19 over suspected links to Kurdish militants.
Adnan Selcuk Mizrakli was Diyarbakir mayor before he was replaced by a government-appointed governor.
"There can be neither democracy nor rule of law in a place where elected officials do not leave via the ballot box," Imamoglu told reporters in Diyarbakir.
He had met with ousted Mardin mayor, Ahmet Turk - a key figure in the Kurdish movement - and Mizrakli, who said Imamoglu's visit offered "a glimmer of hope and was a source of strength for us".
His visit to the Kurdish-majority region is significant for the secular CHP, which has not always had easy relations with the HDP.
But since Imamoglu's election success was significantly supported by the votes of Kurds, as the HDP put forward no candidate in Istanbul, this relationship has improved.
The Istanbul mayor also paid tribute to Tahir Elci, head of the bar association in Diyarbakir and a campaigner for Kurdish rights, during a visit to his grave.
Elci was shot dead during clashes between Kurdish militants and police officers in 2015.
Last May, the CHP's presidential candidate Muharrem Ince visited the imprisoned ex-HDP chief Selahattin Demirtas ahead of presidential elections in June 2018.
Follow us on Twitter: @The_NewArab