The OP has images of Starbuck from Battlestar Galactica. That was a successful swap, I liked it. Someone mentioned Nick Fury. That worked too. Another good one was Watson in Elementary. They pulled it off.
It's difficult to put the finger on which cases are good and which aren't. As a rule of thumb, it's better not to touch the race and gender of an established character. If there's any doubt then there's no doubt - don't touch it. I think intent matters a lot though, like people already argued. If you just want tokenism, it will turn out shitty. If you want to explore a what if, new angles on established fictional relationships, or you found a casting that genuinely works with the character but is not of the same gender/race, then it might work out.
It's difficult to put the finger on which cases are good and which aren't. As a rule of thumb, it's better not to touch the race and gender of an established character. If there's any doubt then there's no doubt - don't touch it. I think intent matters a lot though, like people already argued. If you just want tokenism, it will turn out shitty. If you want to explore a what if, new angles on established fictional relationships, or you found a casting that genuinely works with the character but is not of the same gender/race, then it might work out.