In Another Time, Another Place, suspicion falls on the Italian POWs when one of the local girls is raped. Janie goes to the military to provide Luigi with an alibi to exonerate him, but she finds that he'll be charged anyway for "association with a civilian female" for having a consensual relationship with her.
In Cloudy with a Chance of Meatballs, Flint is ostracized in the town because his inventions always fail spectacularly, which is a shame, since most of the things he invented were made with the intent of helping people out. Even when he invents something that does end up working, saves the town from a depression, and gets him the love and respect he always wanted, it still manages to Go Horribly Wrong in the end, threatening to destroy the whole world.
In The Dark Knight Sal Maroni explains to Batman that nobody will tell him where The Joker is because Batman has "rules," while the Joker does not. In a choice between the two, it's healthier to make Batman mad to avoid pissing off the Joker than it would be the other way around.
In The Dark Knight Rises, Bane became Talia's protector and helped her escape. This selfless action on his part resulted in several prisoners exacting revenge on him by beating him within an inch of his life, forcing him to don an anesthetic mask. And later he was banished from the League of Shadows because of his relationship with Talia.
The plot of Dragonheart is kicked off when Draco agrees to give half his heart to save the dying prince...who then grows up terrorizing the kingdom and can't be killed unless Draco himself dies. To twist the knife on poor Draco, he ends up being the Last of His Kind directly because of the deed, since Bowen blames his heart for "corrupting" the already evil prince and vows to wipe out all dragons in retaliation.
In Escape to Witch Mountain, Tia saves a man's life. That man, Lucas Deranian, turns out to be an employee of Aristotle Bolt, a billionaire searching for supernatural powers to exploit. Bolt sends Deranian to pose as Tony and Tia's uncle, bringing them to his isolated mansion.
In A Fistful of Dollars the Man With No Name manipulates the Mob War in San Miguel with ease; the only time he messes up and gets himself in real trouble is when he stops focusing on making money for a second and decides to free a woman the Rojo brothers were holding captive. This act tips off the Rojos that he's not on their side, leading them to ambush, capture, and torture him.
In the French comedy La folie des grandeurs, Blaze saves King Charles II's life and exposes the plot against the throne (among other good deeds) but is still sold into slavery
Another Lindsay Lohan movie, Georgia Rule, gets outright literal in here: Mormon Harlan gets to Georgia's house to fetch her grand-daughter Rachel (who performed oral sex on him on a canoe) to convince her to get his actual girlfriend together with him to release him for his sins. When Rachel yells at him that it wasn't a big deal, but just a blowjob, and Georgia comes into the scene in a severely shocked manner, Rachel just responses that "no good deed goes unpunished".
In the Halloween (2007) remake, Ismael, the only security guard in the institution who ever showed Michael Myers compassion and stopped the others from bullying him, is given an over-the-top and painful death. The poor guard's final words are a tearful, "I was good to you, Mikey!"
In the sequel, the daughter of one of the rednecks who beat down Michael for trespassing pleads with them to leave him alone, and at least apologizes when they leave him for dead. Dead just the same.
In The Incredibles, Mr. Incredible stops a suicidal man from jumping off a building but accidentally injured the guy in the process. The dude "repays" the favor by suing him. This, and a buck of other lawsuits from people injured in the process of being saved, leads to a registration act that forces all superheroes into hiding, and the actual person responsible for their injuries, Bomb Voyage, ends up getting away with it scot-free, since it was his bomb that resulted in the railroad tracks they were on being destroyed and forcing Mr. Incredible, who was trying to save Buddy Pine from being blown to smithereens by that bomb, to stop the train from falling over the gap caused by the explosion.
In In Time, Will's mother dies as a direct consequence of giving Will enough money for lunch.
Actually the Designated Villains of the film, as they constantly help out the Designated Heroes by saving them from the dinosaurs, only for them to usually cause an incident that has the dinosaurs attacking them.
Mean Girls: when Cady goes to apologize to all the people she's hurt, she includes her math teacher "Mrs. Norbury, who's living proof that no good deed goes unpunished".
To be specific, Mrs. Norbury is concerned by Cady's declining grades, which she knows is a result of Cady pretending to be less intelligent than she really is, just to get the attention of a boy. While trying to motivate Cady, Mrs. Norbury tells her she's a "pusher" and intends to push Cady to fulfill her potential. All this does is cause Cady to twist her words later, telling the Plastics that Mrs. Norbury is probably a "drug pusher". They get her to write that in their notebook, which is later distributed to the school, causing Mrs. Norbury to be arrested on suspicion of drug dealing.
Happens in the end of the Mexican film Un Mundo Maravilloso, but not to the protagonist: The main character (a homeless hobo), having crossed the Despair Event Horizon because he believed his wife was dead (she wasn't, as he happily finds out soon after), wanders into a middle class neighborhood during a storm. A middle class family upon seeing him from the inside of their house, immediately out of kindness offers him shelter and gives him clothes, blankets and food. How does he repay them? Near the end of the film after deciding that "Better a day as a rich than a lifetime of poverty!" he, with the help of his family and buddies, invades and takes over that very same middle class house, killing its owners.
No Country for Old Men. Llewelyn Moss would have gotten away with stealing the drug cash if he hadn't gone back to give water to a dying man.
A particularly nasty example in Serendipity where Jonathan's fiancee buys him a book because she's seen him looking at copies of that book dozens of times. Unbeknownst to her, he was only looking to see if it was the copy in which a former love-interest wrote her name and phone number. The copy she buys him turns out to be that copy, and he jilts her at the altar to pursue the other woman now that he knows her name. In other words, his fiancee ends up heartbroken and humiliated as a direct result of her buying him a book she had reason to believe was the perfect gift for him!
In Silver Linings Playbook Tiffany's husband, after coming home from buying her lingerie to spice up their relationship, helps a motorist who's broken down. He's struck and killed by a passing vehicle.
In Snake Eyes, Nicolas Cage plays a sleazy corrupt cop who suddenly finds his conscience when he uncovers and subsequently tries to prevent a plot to assassinate a political whistleblower. He succeeds, and in the epilogue he is initially hailed as a hero, but winds up going to jail after the extra publicity shines a light on his shady past.
Wu Xia: Xu Baijiu has this as his motivation. He once caught a kid stealing from his parents, but let him go without telling anyone. He got poisoned for his trouble.
Most of the Jedi were not slaughtered by Anakin and Darth Sidious likely would have been able to exterminate them and take over even without Anakin, given his success at manipulating the jedi; however Obi-Wan's death comes at the hands of the man he trained, and spared from death in single combat.
The Elite Squad: Matias trying to get Romerito spectacles. The student he told spilled the beans to the drug dealers and when Neto volunteered to help him pass them to the boy he gets fatally shot.
This is a recurring theme of The 400 Blows. When Antoine's grades falter, he commits himself fully to completing a writing assignment...and gets accused of plagiarism. Likewise, near the end of the film, he steals a typewriter and gets arrested for it. The kicker? He's not arrested during the actual theft; he's arrested after he feels guilty and tries to return it.
Byzantium: Poor Noel. He takes in an apparently desperate mother and child and ends up dead for his trouble.
Contrary to how people reacted in the first film, in Hellboy II: The Golden Army, Hellboy and his friends save the city from a giant forest god. He also goes out of his way to protect a tiny baby the whole time. The baby's mother thanks him by yanking her child away in fear and people boo and throw a rock at Hellboy. This only reinforces Prince Nuada's belief that humans are selfish, dumb ingrates.
In Ex Machina, Caleb helps Ava escape but, without a second thought, she leaves him behind to die a slow, agonizing death in the compound.
In X-Men: Apocalypse, Magneto is trying to live a quiet life under an assumed identity with his wife and daughter. However, when he uses his powers to save a factory worker from dying in a work accident, someone in the factory spots this and reports him to the police, which ultimately results in the deaths of his family. This ends up being the main reason Magneto ends up joining Apocalypse.