"A couple of fellows meet accidentally, like you and me. No connection between them at all. Never saw each other before. Each of them has somebody he'd like to get rid of, but he can't murder the person he wants to get rid of. He'll get caught. So they swap murders."
Oh, hello there. I didn't see you. I was too busy thinking about my horrible father — but you don't want to hear about it. You probably have troubles of your own. Perhaps a shrill ex-wife? And you don't want to pay her alimony anymore, you say? Well, perhaps we met for a reason. Listen: I'll "X" your ex, if you pop my pop. Ah, I knew this was a good idea. We'll each have alibis for the other crime, and we won't have apparent motives for the one we did commit. It's perfect — we'll never get caught.
A non-lethal version of the trope exists on sitcoms, in which two characters who can't bring themselves to tell loved ones something that will hurt them will swap duties thinking it will be less painful coming from the other character.
Non-murder example: In OperationP.O.W.E.R.P.U.F.F., Mojo Jojo and the Delightful Children pull this with Mojo Jojo kidnapping Numbah Three, and the Delightful Children kidnapping Ms. Keane. Mojo Jojo even points out the trope maker when he reveals the plan.
Horrible Bosses name-checks both the above movies. Of course, they miss the important points that they shouldn't know each other, and they should have alibis when the other murders happen.
The Trope Maker, Patricia Highsmith's novel Strangers On A Train, also isn't quite a straight example. From the start, Guy Haines explicitly refuses to be part of Charlie Bruno's plot, and leaves him to find somebody else. Unfortunately, Bruno is fond of Haines, and kills his wife anyway as a favor. Then he starts stalking Haines to try and make him follow through with his end of the "bargain". Unlike in the Hitchcock movie, Haines becomes so demoralized that he does kill Bruno's father. The plot is eventually found out by the police, in large part because Bruno ignores the "strangers" bit and starts wedging himself into Haines's personal life.
The Shadow Club begins as the PG version of this, with various bullied teens exchanging pranks. Then someone begins to commit more serious misdeeds, some of them dangerous, and none of them are sure who's gone too far. Everyone except the narrator did one and only one of the serious misdeeds on the unknowing behalf of one other club member they cared deeply about. The narrator winds up accepting guilt for his girlfriend's "prank," which permanently crippled a Jerk Jock.
Done in a fairly easy Clue tie-in mystery book. There are three failed attempts at murder, in each case two people with motive are missing. Since one was missing on all three occasions, the two killers are obvious.
In A Pen-Knife in My Heart, a novel written by future Poet Laureat Cecil Day-Lewis under his Nicholas Blake pen name, Stuart Hammer takes weak-willed author Ned Stowe out on his boat and makes him a proposal. Stuart will kill Ned's wife so that Ned can be with his mistress Laura. In return Ned will murder Stuart's uncle, who's also his boss. Published eight year's after Strangers on a Train and six years after Alfred Hitchcock's movie, the plot was close enough so that Day-Lewis had to make some last minute changes in order to avoid a lawsuit from Highsmith's publisher.
Live Action TV
In the Castle episode "The Double Down," it was Strangers on a Boat.
Castle even does the "criss cross" gesture. As a writer, he is understandably excited.
In the NCIS episode "The Inside Man," it was Strangers on a Commuter Train... although the crime was insider trading rather than murder, at least to start with.
Interestingly, this one, and the above Castle incidence originally aired within the same two-week timespan, if memory serves.
The episode "Alibi" has this again with Strangers at an AA Meeting. In fact, the suspect in a hit-and-run tries to alibi out to his attorney by explaining that he was stabbing a guy to death in another town during the hit-and-run, and she can't tell anyone due to the attorney-client privilege (she still finds a way to leave a hint for Gibbs).
Heartbeat. Local rogue Claude Greengrass has just been to see the movie Strangers on a Train and jokes loudly afterward about how he's like someone to burn down his old barn for the insurance money. Unfortunately, someone takes him at his word, and gets nasty when Claude doesn't keep his side of the 'bargain'.
Due South does a version with one murder in Chicago and the other in Toronto.
In the Modern Family episode "Strangers on a Treadmill", Mitchell suggests to Claire that he tell Phil his jokes are rotten while she tells Cam that he shouldn't wear embarrassingly revealing bicycle pants.
Dick Van Dyke also subverted this trope in an episode of Diagnosis: Murder. A deranged psychiatrist killed a hospital administrator who was going to recommend that Dr. Sloan(Van Dyke) be dismissed from Community General when he protested her bone-deep budget cut recommendations. The psychiatrist then called up Dr. Sloan and told him, "Now you owe me a favor." Dr. Sloan refused to play along.
Series two of Psychoville features a parody/homage of "Strangers on a Train." David agrees to kill Mrs Wren so that her nephew can inherit her money, with the nephew agreeing to "relieve Maureen of her pain" (she is dying of cancer) in exchange; they meet on a train to discuss the plan. It backfires when Jelly escapes with the real Mrs Wren, leading to her roommate (who was wearing a borrowed cardigan with Mrs Wren's name sewn into it) being mistaken for her and murdered by Finney, and David finding the body. Meanwhile, Maureen catches Wren's nephew breaking into her house, and kills him - then discovers he wasn't planning to murder her, he was there to give her a disabled parking badge.
The Closer has a non-murder (at least initially) variation. A group of teenagers whose parents are all well-off make a plan: each time one of them goes on vacation with their family, the rest of the group will break into their house and steal laptops and stuff, because they figure that they want stuff, and since their parents are rich they can just replace the missing things. It backfires when one of them decides he doesn't want to do it anymore, but the others decide to break into his house anyway when he and his parents go on vacation, and accidentally kill the house sitter.
Criminal Minds episode "The Pact" has a pair of women who've had a child relative killed by people who escaped justice deal with each other's target this way. Reid quickly figures this out and references the trope namer.
Done in a Columbo episode "A Friend in Deed", although the perpetrators are not really strangers. They almost manage to get away with it.
Medium had 5 Strangers On An Airport Lobby combined with Serial Killings, Specific Target: the victims would all be poisoned with the same tainted painkiller, so that the deaths would be blamed on a serial poisoner, since there was no apparent connection between the killers.
The Silent Witness story "Supernova" is based around this, with teenage girls plotting via the internet to murder people on each other's behalf.
Done in the Death in Paradise episode "A Dash of Sunshine", although the first murder is not seen; having already taken place in another country.
Used in an episode of Rizzoli & Isles. Two people, each wanting to be rid of their spouses, meet at a dog park and agree to swap murders. They're careful not to correspond on computer or talk on the phone, being Genre Savvy enough to know they could be traced that way. Dog hair left at one of the murder scenes is what trips them up.
The Murdoch Mysteries episode "Unfinished Business" has this as a cold case, reopened when one of the conspirators makes a Deathbed Confession, but leaves Murdoch with the impression he killed his own wife, which he can't have done. When Murdoch realises what happened, he even suggests they may have met on some form of public transport.
Fillmore! had an episode where it looked like a vigilante was going after bullies. It turned out that the victims of various bullies had decided to fight back, but they swapped targets so that each of them would have an alibi when the bully they had reason to hate was targeted.
The final episode of the short-lived Gary And Mike, titled "Crisscross", parodied this.
Brandy & Mr. Whiskers: In "Dog Play Afternoon", Gaspar and Brandy are understudies for the main leads of the play. Gaspar suggests Brandy to play dirty:
Brandy:Come on! If something happens to the stars, It would be obvious we did it!