Of all the upsets from last week’s vote, perhaps none is more striking than the ouster of longtime Brooklyn District Attorney Charles “Joe” Hynes at the hands of former federal prosecutor Ken Thompson.

Hynes departs after 24 years in office. During that time, he oversaw dramatic drops in Brooklyn’s crime rate and was a pioneer in the creation of drug courts.

Unfortunately, he’s also an example of what happens when an elected official stays around too long.

As The Post has reported, Hynes had for years declined to publicize the names of convicted sexual offenders in the Orthodox Jewish community. And even though he did secure a rape conviction for unlicensed therapist Nechemya Weberman, four Weberman supporters who tried to intimidate Weberman’s teenage victim got a slap-on-the-wrist probation deal.

At the same time, multiple Brooklyn convictions have been called into doubt — some overturned — because of the questionable behavior of Hynes subordinates. A task force is now reviewing those cases.

With all this, Thompson is signaling that he’ll likely be worse. Already there are questions whether a convicted felon, former Brooklyn Democratic Party boss Clarence Norman, had a role in his campaign. And Thompson has said he’ll go further than the City Council and Judge Shira Scheindlin by placing prosecutors in Brooklyn precincts to track stop-and-frisk.

All in all, it’s a good argument for saying Joe Hynes would have done Brooklyn a service by retiring on his own — and leaving an open seat that might have attracted a higher-quality successor.