The best-known X-Men example would be the tragic flip of Psylocke and Chinese assassin Kwannon. The latter had been rendered braindead after a fall, and when Psylocke turned up amnesiac in China, Kwannon's lover Matsuo saw a chance to restore his girlfriend and turned to the villain Spiral for help. However, Spiral—being Spiral—decided that switching the women's minds would be far more entertaining, and gave both women certain aspects of the other. As a result, Psylocke got Kwannon's martial arts skills while Kwannon's mutant empathic power was given a boost by Psylocke's superior telepathy. This is one of the few examples of the flip being permanent, due to the extant of Spiral's tampering with the women's minds and genetic makeup. Kwannon later joined the X-Men herself as Revanche, but would later commit suicide after contracting the Legacy Virus (aka Mutant AIDS).
X-Men character Emma Frost was rather fond of this one. While still a full-time villain she swapped bodies with Storm as part of an evil plot; years later, just before her switch to heroism, she accidentally swapped bodies with Iceman, and then proceeded to fuel his (already significant) insecurities by using his powers far more effectively than he ever had. She also tried to commit suicide while in his body, but she never mentions that — and considering she's not above using her telepathic powers to make you vomit uncontrollably whenever you hear the word "broccoli", you probably shouldn't either.
Lampshaded in X-treme X-Men once, when at a dinner party, various team members start teasing Ororo, until Kitty stands up and says, "What's everyone talking about? That isn't Storm, I'm Storm! Someone has switched our minds!" Everyone else suddenly glares at her in panicked silence. Then Ororo and Kitty shout, "GOTCHA!".
During the X-Men's Australian run, there was an issue where Dazzler was accidentally switched with the criminal Diamondback. But unlike most hero/villain swaps, neither had any idea what was going on and Diamondback briefly joined the X-Men to get the matter sorted. Besides the clumsiness in getting used to each other's abilities (somehow Diamonback's Improbable Aiming Skills didn't work in Dazzler's body), Dazz was understandably quite pissed when Diamondback smoked cigars and slept with Wolverine in her body.
Also happened in an Ultimate X-Men/Ultimate Spider-Man crossover, when Jean Grey got so pissed at Wolverine's constant attempts to woo her that she sent his mind to the one place he wanted to be least... High School. He ends up spending a day in Peter Parker's body, even attempting to "get busy" with MJ, while Peter, in Logan's body, went from one bad situation to another. He was understandably upset when Jean came to fix things. Then, just when it's finally over, MJ asks him if they can wait until they're older to do what "he" tried earlier.
Colossus: Why am I an #$@#$@? I was just standing here.
This issue was loosely adapted as "Freaky" in the Ultimate Spider-Man cartoon, with the main difference being that Mesmero was the cause of it.
In the run up to Amazing Spider-Man 700, Doctor Octopus inflicts this on Spidey - with the added problems that Ock's body is a) in prison and b) on its last legs after years of punishment, only barely kept alive by life support. How does Peter get out of it? Well, he kind of... doesn't. He manages to get himself out of prison, but eventually dies inside Doc Ock's body, but not before making Ock make a Heel-Face Turn, and after Peter dies, Ock vows to be a better Spider-Man than Peter ever was. A Superior Spider-Man, if you will.
Sleepwalker and his human host, Rick Sheridan, ended up switching bodies for several issues after a botched attempt to release Sleepwalker while Rick was awake. In Sleepwalker's body, Rick ended up battling supervillains and supernatural horrors of the Mindscape, while Sleepy had to fill in for Rick in his human life, ironically having more success with women than Rick himself. The body swap was, in fact, a key part of the Evil Plan hatched by Big Bad Cobweb to invade the Earth and make Rick think Sleepwalker was the invasion's leader, hindering any attempt Sleepy might make to stop him.
Adam Warren's Amerimanga version of the Dirty Pair did this to themselves on purpose during the "Run from the Future" miniseries.
Happened once in #37 of the Sonic X comic, in which Sonic and Dr Eggman switched bodies. Truth be told though, neither took real advantage of it, despite the cover suggesting more heinous actions by Eggman (in Sonic's body). Eggman in Sonic's body is unable to control Sonic's speed, while Sonic in Eggman's body has a hard time driving the Eggmobile. The story is resolved when the two use the ray Eggman used to swap their bodies to swap back. Eggman's comedy relief henchmen, Decoe and Bocoe tie up Eggman in the end, believing he is still Sonic, and interrogate him.
In Super Sonic Special #12, Sonic and Knuckles switch bodies thanks to a scheming Dimitri and fake Robotnik, in order to blackmail them into getting the Master Chaos Emerald.
In his case, a lot of these instances deviate from the norm of this trope in that the switch is deliberate on the part of the other involved party.
The Justice League had an issue where this happened with all the core members getting mixed up with each other. The big spoiler was when it turned out that Superman didn't end up in Batman's body but in Kobra's and Kobra pretended to be Superman trapped in Batman's body.
There was an interesting case in the Superman tie-ins to Infinite Crisis. During their titanic tussle on Earth-2, Superman and Kal-L end up reliving each other's lives, but start altering it. For Superman, revealing his identity to the Senate would end up leading to a future where Earth-2 was totally unprepared for the Anti-Monitor, leading to him being crushed like a bug. For Kal-L, calling out Batman's bluff during the Man of Steel mini-series and snapping Doomsday's neck and just not dying leads to a world where a superhuman war destroys the planet. They both think that the other world is the one that can't exist.
In The Superman Adventures, one comic, "Jimmy Olsen vs. Darkseid" has the Intrepid Reporter and Superman trapped in each others' bodies as the result of Jimmy fouling up a villain's body-swapping scheme.
In an episode of Iznogoud, a wizard invents a magic bowl: whenever two people drink consecutively from it, they exchange souls. Hilarity Ensues when this new invention gets tested by several patrons in an inn, just for fun. One of the catches is that it doesn't have to be actually people who drink: animals count too. (The wizard himself ends up in the body of a parrot.) Or even inanimate objects, for that matter.
Doctor Doom learned the trick of switching bodies from a benign alien race called the Ovoids. He first used it quite successfully on Mr. Fantastic in Fantastic Four #10 (1963) but not that often afterwards.
Though it did save his life in the 1980s, when Doom's body was disintegrated in a battle between Terrax and the Fantastic Four. He switched bodies with a bystander at the last second.
In a What If? story, "What If Tony Stark Became Doctor Doom?", Victor Von Doom and Tony Stark were college roommates, until Doom trapped Tony in a mind-transfer device, taking the precaution of wiping Tony's memory before swapping minds with him. Doom, in Tony's body, took over Stark International(possibly killing Howard Stark to achieve that end) and became a hugely successful Corrupt Corporate Executive. Stark, meanwhile, in a neat subversion of Easy Amnesia, never regained his memories but retained his intellect and achieved several doctorates under the name Victor Von Doom. As Von Doom, he started his own company in Latveria, and developed his own powered armor, which he used to counter "Stark" when he tried to destroy Von Doom Industries with his own powered armor. On the verge of defeat, Doom offered to restore Stark's mind to his body in exchange for amnesty, saying, "I can give you your family name back." Stark refused, saying, "You have made the name Stark synonymous with corruption and corporate avarice. Why would I covet that?"
A witch body-swapped with a much younger housewife in "Judy, You're Not Yourself Today!", in Tales from the Crypt #25.
The DC ComicsSilver Age megaseries by Mark Waid involves a villain called Agamemno swapping the Justice League of America's minds with the Legion of Doom. This means that all the powered heroes have lost their powers, and even the unpowered ones have lost some of their abilities (Batman is stuck in Penguin's unathletic body; Green Arrow complains that Felix Faust has lousy eyesight, spoiling his aim).