Robert Linn has to be up there, he served as mayor of Beaver, Pennsylvania for 58 years from 1946 until his death in 2004 at the age of 95. What surprises me is that he was a Republican, I can't believe a Republican was elected in that area in 1946.
In local elections the party affiliations matter less. The guy I mentioned is a Democratic Town Supervisor for Lee, New York. It's the mostly rural area north of Rome-- already the largest city in NY to vote Republican in 2020. Trump won Lee 66%-33%.
Despite everything that we.think about the modern electoral scene, the old truth is still relevant: the farther down the ballot, the name of the person gains increasing relevance, and the party label decreases.
When the electorate is small enough, you the incumbent actually can meet every voter if you want to. You also get free local name recognition from the local TV (and historically papers) and you are there at the local events. Unless there is a scandal, or term limits like in most big cities now, it's not hard to get entrenched. And then it's your voter base, not the party's. Changing ID in this situation, like many have done in the South, is a simple task. You do it once control over local Government changes hards, to maintain your past presence within the local system.
Which therefore leads into another point of discussion: long-tenured statewide officers who seemingly enjoy all the results of the above - popularity and a personal vote - without the local factor. La Follette in Wisconsin (who has finally retired) and Tom Miller in Iowa (who barely lost his attempt at an 11th term by 2%) come to mind, but I'm sure there are others.