Or when the supposed target of the slur claim it as an unoffensive word and treat like something of a term of endearment among themselves.
This is called amelioration:
In linguistics, amelioration is the upgrading or elevation of a word's meaning, as when a word with a negative sense develops a positive one. Also called melioration or elevation.
Amelioration is less common than the opposite historical process, called pejoration.
Amelioration (word meanings) — Glossary of Grammatical and Rhetorical Terms