Undercover Cop Reveal

At its simplest form, a character reveals himself to be an undercover police officer, FBI agent, what have you. Often, he's acting as a Reverse Mole, trying to get enough evidence on the villain to arrest him for Arson Murder and Jaywalking. It's entirely possible that we, the viewers, won't find out until the rest of the characters do as well. Depending on what side of the Sliding Scale of Idealism Versus Cynicism, this may or may not end badly for the cop.

Comic Books

 * Done twice in "A Night at the Rose Petal" in The Maze Agency Annual #1.
 * Happens twice in Jack Chick tracts. In "Bad Bob," Bob and his cousin deal drugs, and find out their buyer is a cop when he reads them their rights. In "Trust Me", the kid, to fund his drug habit, sells drugs to an undercover cop with a briefcase full of money, resulting in the cop pulling out a pistol and a badge, which is less surprising than most examples of the trope because he gets down on his knees and says "Trust me!".

Fanfic

 * In the Alvan an The Chipmunks 3 The Second Squeakuel, turns out to be a member of the police.

Film

 * Reservoir Dogs: Mr., just after killing Mr..
 * In The Fast and The Furious, Brian O'Conner reveals to Mia that he is a cop at the end of the movie. The viewer has known this all along but it allows some drama between O'Conner and the girl he has been sleeping with and.
 * Running Scared (1986). When detectives Hughes and Costanzo try to arrest Gonzales and end up caught in an ambush, two of Gonzales' men reveal themselves as undercover cops Montoya and Sigliano and save the Heroes' lives.
 * In Black Dog,  reveals to Crews that he is an FBI agent after he is mortally wounded in a truck-jacking attempt.
 * In the final ending of Clue, reveals himself as an FBI agent, just after shooting.
 * At the end of The Spanish Prisoner, Joe is saved by  who turn out to be undercover U.S. Marshals who have had Jimmy's con under observation since the start.
 * in Monsters Inc. turns out to be an undercover agent of the CDA.

Literature

 * In Heinlein's Magic Inc the heroes are helped by an Undercover Cop Reveal when, essentially, fighting the literal forces of Hell. An FBI agent masquerading as a demon.
 * In Maskerade it's setup to look like Andre might be the villain until he reveals that he is actually an undercover cop.
 * Tricky Business, a rare non-humor book by Dave Barry (although it does have it's moments), is about an illegal casino ship that is also a base for drug dealers, things go wrong, etc. On of the POV characters is a pretty young lady who works as a cocktail waitress, hates her job, and her mother always tells her to quit because it's so dangerous... Makes perfect sense, until the very last part of the book when it's revealed that "cocktail waitress" was just a disguise: she is actually a badass undercover cop, and now everything suddenly sounds a lot smarter.
 * Timothy Zahn's not-quite-Star Wars Space Opera-Mystery-action book The Icarus Hunt. To say more would be to spoil it, though if the reader is both paying attention and actively trying to put the pieces together, it's not that hard to figure it out ahead of time.
 * In the Tim Dorsey novel Hammerhead Ranch Motel, one room at the motel holds two different drug gangs who are secretly undercover cops each of whom is trying to bust the other gang. They only discover this when a third jurisdiction of police shows up and tries to bust both of them.

Live Action TV
"Jenkinson: Blimey...we're all coppers...
 * Turned Up to Eleven in a sketch in Do Not Adjust Your Set. The undercover cop reveals himself to be one to a gang, now that he's got enough evidence to convict them...and then all of them turn out to be undercover cops.

Johnsson: ...So what do we do now?

Leader: ...Jenkinson, can you blow up a safe?"


 * Fastlane episode "Mighty Blue". When officers Van and Deaq confront a criminal gang, one of them reveals herself as an undercover police officer to save them.
 * This happened to Sawyer in the "flash-sideways" on Lost - the scene deliberately echoed a season one flashback which showed him as a con man, only this time the mark called him on it, and he revealed that he was a cop.
 * In the Doctor Who story "The Robots of Death", one of the Sandminer's crewmembers is revealed to be an undercover agent -- and.
 * Occurs in the first episode of Rookie Blue, even though he tries to keep his cover even after being arrested. Its finally blown when an old friend greets him heartily as he is about to be processed.
 * Happens in the episode of The Bill that re-introduced Frank Burnside. Burnside was undercover with a gang of soccer hooligans that are busted by Sun Hill. Burnside headbutts one of the arresting officers to maintain his cover.
 * Hawaii Five O: Sid in "Mala Ka Aina"; Kono in "Ma'eme'e"
 * Liam in The Chicago Code
 * In Suburgatory, a student that Tessa assumed to be gay actually was an undercover narcotics agent.
 * One episode of Veronica Mars involved a suspected plot to bomb the school. One of the prime suspects turned out to be an undercover ATF agent who was hoping to draw out the real bomber by making himself out to be a kindred spirit.
 * Michael Weston planned to do this in an episode of Burn Notice. While trying to score points with the boss of a gang, he sets up The Dragon to look like an undercover cop and then be the hero when he exposes him. Since the guy had no problem destroying valuable property just to scare people, Michael didn't feel too bad for the guy.
 * This trope has been used at least once on Castle, and probably several times. The protagonists are investigating a murder and an early suspect turns out to be an agent of the FBI or ATF who was investigating the victim (or employing the victim somehow, or investigating or another suspect) for their own reasons.
 * The murder of a dog show judge leads the cops (and Castle) all over the place. Eventually, they find a warehouse, where the victim's assistant claims that the guy was trying to cross-breed dogs. After digging around, they start to suspect that the victim was involved in bringing drugs from South America. They confront the "assistant", who immediately tells them that they will, in fact, find drugs hidden in the warehouse. He's a US Customs agent. The victim was employed to train drug-sniffing dogs (hence the drugs and the $10,000/month money transfers).
 * A mild version in Lie to Me where Foster starts dating a high school guidance councillor, only to get strange vibes from him. She then finds passports with different identities and evidence of drugs. After she confronts the guy about it, he admits that he's DEA, sent to uncover a school trafficking ring. He later reveals it to Cal as well, given that Cal can't help but stick his nose in other people's business.
 * An episode of The Famous Jett Jackson shows an episode of the Show Within a Show Silverstone, where all the world's bad guys are invited to a remote mansion by a mysterious new villain named Mr. Kilimanjaro. Throughout the dinner, they start arguing and trying to one-up each other, revealing all their recent and latest plots. It turns out that the whole thing was a setup by Silverstone (in disguise as Kilimanjaro) to get recorded confessions from these guys and grab them all at once.

New Media

 * Occurred in the skits for The Egypt File VBS. The custodian turned out to be an undercover cop on the trail of a notorious artifact smuggler, who had been disguised as a cop.

Video Games

 * Agent Shepherd in Twisted Metal: Head On reveals himself to be FBI rather than take a wish from Calypso.
 * John Doe from Twisted Metal Black discovers that he's an FBI agent, but not until he gets his memory back after the tournament...and standing in front of the number two most wanted man in the world.
 * Doll in Saga Frontier, during Red's game when investigating Berva.

Western Animation

 * In one episode of Dog City, the villain is posing as a school teacher to get into a mint under the cover of a field trip. He is thwarted when it turns out that only two of his students are not undercover cops.
 * In the Batman the Animated Series episode "Almost Got 'Im", as several of Batman's villains play poker at a seedy bar and exchange stories on how they had nearly killed Batman, Joker announces that he had just kidnapped Catwoman and was holding her at an abandoned catfood factory, where he planned to have her killed. Killer Croc then punches out Joker, and the other thugs discover that Croc is really Batman in disguise. When they decide to take him out, every other patron of the bar turns out to be a cop. The gathered cops, led by Commissioner Gordon and Detective Bullock, take down the villains, leaving Batman free to rescue Catwoman.