The original, “the only good Indian is a dead Indian”, has been attributed to American Civil War General Philip Sheridan, in response to salutations from Comanche chief Tosawi1, c. 1869. It’s not clear whether he actually said it, but whoever said it, it spread in this form. Indian seems to be the commonest X, but pig, racist, republican, fascist, abortionist, commey [sic], and chinaman also appear in this slot. X is not only limited to slurs, but it does tend toward people and items the speaker has great (real or tongue-in-cheek) contempt for, like the hipster, pabst, raver, clone, poodle, or barney.
1Tosh-a-way? Toshaway? I wasn’t expecting to come across the Indian name hyphenation problem here–but then, I didn’t know Indian was the original X.