ST. PETERSBURG — It's been more than 26 years since a St. Petersburg mayor lost re-election. And that 1987 election barely counts, considering that Mayor Ed Cole spent exactly $2 on his re-election campaign, refused to let any volunteers work on his behalf and offered nothing but kind words for the ultimate winner, Bob Ulrich: "If I wasn't running, I would have voted for him myself."No, Bill Foster's loss Tuesday was something else entirely, something truly astonishing. More than 7 in 10 likely St. Petersburg voters told our pollster that the city is headed in the right direction. They fired the guy in charge anyway.It barely makes sense, except in the context of how far St. Petersburg has come since it routinely elected kindly retirees as mayor, shed its chronic inferiority complex and emerged as one of the most appealing cities in the Southeast.Bill Foster is a good man who presided over no corruption scandal, no violent racial unrest. He weathered a brutal recession and ended a panhandling epidemic that dominated the campaign trail discussion four years ago.He aspired to be St. Petersburg mayor (or at least city manager) for much of his life. Once in the job, though, Foster ran into the city's new political reality: Adequate no longer cuts it. Early on, he underestimated voters' intelligence, talking about a secret plan to keep the Tampa Bay Rays in St. Petersburg. And nothing fueled the perception of a leadership vacuum at City Hall more than the Pier/Lens fiasco where Foster's position was either a mystery or ever-shifting.A lot of people will point to this campaign being the most overtly partisan in St. Petersburg history. It was, and Democrats can crow about not only winning the mayor's seat for the first time since 1975 (and sweeping the City Council races), but also now leading the city halls of every major city along the Interstate 4 corridor.But partisanship never explains St. Petersburg elections as much as racial politics do. That's why a heavily Democratic city consistently elected Republicans until Tuesday. Every successful mayoral campaign for decades has relied on strong support from neighborhoods with large African-American populations. In that sense, Foster's defeat probably started at least two years ago when he fired controversial administrator Goliath Davis as the city's administrator focused on Midtown.The mayor could easily explain his decision to fire Davis, after the former police chief failed to show up for the funerals of officers killed in the line of duty. He never really explained why he decided against hiring a replacement to concentrate on Midtown until weeks before a tough re-election.For all the positive trends in St. Petersburg, Midtown remains the soft underbelly that no mayor can afford to ignore. Former Mayor Rick Baker never left any doubt that it was a top priority. Foster left enough doubt about his commitment that he provided a big opening for Kriseman, a challenger with little history in Midtown, to win considerable African-American support.Kriseman's team boasts of running the most sophisticated, data-driven campaign St. Petersburg has ever seen. Perhaps, but the lawyer and former legislator did not win the race as much as Foster lost it. Unlike the divisive insurgent candidates who have run and lost in election after election in St. Petersburg, Kriseman presented himself as a safe, credible alternative for those unimpressed with the incumbent.The Kriseman campaign boiled down to a simple promise: He'll be less like Bill Foster and more like Rick Baker.Four hours before the polls closed Tuesday, Kriseman's team arrogantly sent an email announcing his transition team. Tacky.The likely retirements of several longtime, senior administrators means Kriseman will lose decades of experience and have key hiring decisions looming. Even some of his supporters worry Kriseman could be tempted to fill those jobs with patronage hires.The mayor-elect would be wise to learn from the mistakes of Foster. Kriseman showed he can run an efficient, cautious campaign. He surely realizes by now that St. Petersburg voters expect much more than that in the mayor's office, and can be unforgiving of those who fall short.