Strom Thurmond switched parties and was elected both ways, but I don’t recall if he did the resignation dance.
Thurmond did resign once, but for a different reason. He was first elected to the Senate as a write-in and agreed to resign after serving for a year and a half to run in a regular primary election, which he won (this is why he had a break in his tenure, first elected in 1954, resigned in April 1956 and resumed office in November 1956 serving until January 2003). He switched in September 1964, 2 years before the regular general election.
Another member from SC serving with Thurmond, Albert Watson, was elected as a Democrat, but after he endorsed Goldwater, he was stripped of his seniority, formally resigned in February 1965 and was reelected 4 months later as a Republican.