The 1993 NYC Mayoral Election, a rematch between the first African-American Mayor of NYC David Dinkins and former United States District Attorney for the southern district of New York Rudy Giuliani resulted in the first republican win since John Lindsey in 1965.
The Campaign was viscious, with Dinkins & Giuliani playing up race and antisemitism in their attacks of the other, in addition to the issue of Crime dominating the campaign, to Giuliani's benefit.
In fact, 4/10 voters according to an NYT exit poll cited crime as a major concern, with 2/3rds of them voting for Giuliani, the former attorney for the southern district of New York; moreover more than half said the city was less safe than when before Dinkins took office
Racial Tensions were high throughout the campaign, with the Dinkins campaign liking Giuliani to David Duke, and the Giuliani campaign accusing the dinkins campaign of playing into "Black Victimization" (NYT).
In the end, the issue of Crime, and Giuliani touting endorsements from Democrats such as former mayor Ed Koch Ended up giving him the boost he needed to reverse the 1989 results and win in his rematch with Dinkins.
The 1997 Campaign By contrast, was anything but competitive. In pitting Incumbent Rudy Giuliani against Manhattan Borough President Ruth Messinger, Giuliani's popularity ended up leading to a route, allowing him to defeat Messinger by over 12%
During the 1997 campaign, Giuliani was exceedingly popular in the city, with most beleiving the city had become safer, a booming economy, and a sturdy personal financial situation, his approval was through the roof - with most liking the direction of the city.
This resulted in the media all but ignoring Messinger's campaign, something which combined with Giuliani's popularity and disiplined campaign to produce a landslide for the incumbent republican in the Deep blue city in 1997.
Both of Giuliani's victories can be attributed to him doing well in the White Ethnic neighbourhoods in North Queens, South Brooklyn, Staten Island & the predominantly upscale white neighboorhoods of the Upper east side & lower Manhattan. Carrying Whites overall in 1997 by 76-21%
By contrast, both of Giuliani's challengers won the minority vote, Dinkins by traditional margins, & Messenger by less than that (Dinkins won over 90% of the black vote & 63% of the Hispanic vote where Messenger respectively carried both groups by 80-20%, & 56-43%)