How are you going to avoid this? You either elect the sheriff directly, or you elect the people who appoint the sheriff. Either way, they are going to be subject to political whims.
Fair enough, although there might be SOME benefit to having separate election systems for the two roles; it might provide some check against one of the election systems being compromised.
I'm not saying that either system is perfect, but it seems to me the idea that somehow being elected makes a sheriff better is outright false.