Henny in All-of-a-Kind Family is devious and likes to cause trouble for people, but nonetheless cares deeply for her sisters and baby brother. She was also quick to defend Guido, a young orphan boy who was being harassed by a shopkeeper, and when she conned a doll from a charity, she ended up giving it to a homeless girl.
In Gilbert's case this is actually something of a Subverted Trope. Among all the girls except Anne, it's widely understood that Gilbert is just a Nice Guy who teases the girls he likes (which is not uncommon for 11-year-olds).
There are also Mr. Harrison and Norman Douglas.
Artemis Fowl. Played straight from the second book onwards, where Artemis has moments of genuine concern for his allies, and the fairies go from being Enemy Mine to being friends.
Also works with Jaime as the books progress. The jerk in him is easy enough to spot, but after reading his perspective, you realise that from his point of view, all he has ever done is really for love. He fiercely defends Brienne when someone insults her (when she isn't even there), will jump into a bear bit to save Brienne, and has the head of a girl's rapist presented to her. He also warns a man who is interested in said girl to only do something if she wants it.
In the Belgariad, Prince Kheldar (aka, Silk) is a spy/merchant/assassin/thief (usually simultaneously), is constantly throwing smartass remarks into people's faces, and he's known to purposely needle minor characters by talking about identified weak spots—whether it's purposely getting history wrong, or just exposing them to his own memorable personality. Likewise, Beldin likes annoying Belgarath, who is also capable of messing with people. It definitely says something about the average level of personal interaction in this universe that Polgara is the Team Mom of the bunch, despite having a personality abrasive enough to strip paint. On the other hand, they do care deeply about their friends and family, and don't (usually) don't indulge in gratuitious collateral damage.
In The Book of the Dun Cow, Chauntecleer the rooster's Hair-Trigger Temper causes him to constantly verbally abuse Mundo Cani, and he can sometimes be quite selfish. However, he is also the leader of the good guys and shows many times that he does care about his wife, land, and people.
Several characters in Chronicles Of Magic; most notably being Skeeter Traps, who tends to show her concern for others via punching and insulting them.
Dedicate Rosethorn from the Circle of Magic books is irritable, snarky, refuses any and all help when she desperately needs it, and constantly threatens gruesome deaths on her charges. Yet she gives a great deal of herself helping others - nursing the sick and restoring medicines in Briar's Book, leaving Summersea to save the village in Melting Stones (never mind that she's just returned from a war and is completely spiritually exhausted). She also adores her student, Briar, however much she tries not to show it.
Tris also is like this, and so are some of the other teachers and secondary characters, like Dedicate Crane.
Lord Wyldon of Cavall from the Tortall Universe is a bit of a jerk towards women, believing that they should Stay in the Kitchen and putting Keladry of Mindelan on probation for her first year as a page, despite the law that says that noble girls can try for knighthood. On the other hand, he has a sense of honor and fair play, feels ashamed upon realizing that he almost refused to let Kel continue despite how good she was, and admits that she may be the best knight he ever trained.
In Claudius The God, Claudius describes his lifelong friend Herod Agrippa as "a scoundrel with a golden heart." His description of what this entails is classic Jerk with a Heart of Gold.
Superintendent Andrew Dalziel from the Dalziel and Pascoe novels and TV series. He comes across as your typical overweight northern alcoholic bigot; but if you serve under him, despite the verbal abuse you'll get, he'll do his damnedest to fight tooth and nail for you. He's is an overweight, apparently bigotted, sexist old-fashioned copper who insults just about everyone he meets. On the other hand, he will fight like hell to protect any member of his team, did everything he could to advance Peter Pascoe's career (in the novel where Pascoe's promotion to Inspector is announced, it is revealed that Dalziel kept the news back from him initially because Pascoe's friends had just been murdered and Dalziel wanted him to be in a position where he could enjoy the news) and took the announcement of Wield's homosexuality in his stride and did everything he could to protect him from a genuinely bigotted superior.
All three of the main protagonists in Deep Secret are this. Rupert is a self-centered workaholic who has a tendency to miss the forest for the trees, but it's partially to stop himself from caring too much about his job and becoming emotionally ruined. Maree is an Iron Woobie who's life is currently at a serious rough patch, who's developed an extremely prickly exterior to keep herself from hurting even more. And Nick is, well, fourteen. (But he also has an overbearing mother he's trying to push away.)
Commander Sam Vimes, of the Discworld City Watch, is reputed as a hard-faced, hardheaded, cynical, foul-tempered, arrogant thug. Yet even the most dangerous mob boss in the city respects him as a straight-arrow, unbribeable (and though this is helped by his being the wealthiest man in the city, he was giving half his pay before that to the widows and orphans of the Watch), almost painfully-upright man who always does the right thing and never lets the Watch overstep its authority. He is, in fact, one of the most powerful authorities in the city, who hates and distrusts authority — as the Patrician says, "practically Zen".
Invoked and demolished with regards to Albert, Death's manservant. "And it's no good thinking you can appeal to my better nature under this here crusty exterior, 'cos my interior's pretty damn crusty as well." He was the head of Unseen University at its most cutthroat, after all.
Despite her intimidating demeanor, Granny Weatherwax is a good witch, albeit with much reluctance. She's hard and sharp as flint, but that's because she likes to test people; as Tiffany Aching notes in A Hat Full of Sky, witches do their hardest work on "the edge" (between life and death, right and wrong, and so on), and "the edge is no place for people to break."
In Wintersmith, Granny makes very, very sure that Tiffany is out of sight before she takes in the kitten Tiffany left on her doorstep. She has a reputation to maintain.
Moist von Lipwig fits this to a degree (though he is more of a reformed Gentleman Thief), in that all his plans are self-serving, but he usually manages to do a ton of good deeds along the way. In Making Money, he reflects: "Am I really a bastard or am I just really good at thinking like one?"
Nobby. Vimes probably sums him up best when he describes him as someone you can trust with your life — but you'd be daft to trust him with half a dollar.
Rincewind insists he's a Dirty Coward who cares only about himself, but he's been beaten by reality hard enough to feel genuinely selfless towards other people.
Vidia from the Disney Fairies series is usually described as the nastiest fairy, and has been shown time and again to be condescending to others, and only care about herself. Yet in Fairy Dust and the Quest for the Egg, she shared the last of her dust to save Neverland, and has occasionally shown a soft spot for Prilla.
Taken much further in the movies. In Great Fairy Rescue, Vidia gets Tink captured by humans but feels regret almost immediately. She goes for help and leads the expedition to rescue Tinker Bell, admitting her mistake when they were almost at the house. Later, she pushes Tink out the way and is trapped in a jar, and when rescued by the same fairy that she saved earlier, she becomes a permanent member of Tink's gang.
Edgedancer (a novella of The Stormlight Archive): Stump is unpleasant, off-putting and seems to really dislike the children she's supposed to take care of as the owner of an orphanage, often assuming that they fake illnesses to get free food and bedding. As it turns out, some of this is an act - she literally cannot take as many children as she should or would like to, because she has neither the space nor funding, so she tries to scare them away instead. Also, she's a burgeoning Truthwatcher and is unconsciously healing the children, which is why they always seem to "give up the act" after a few days.
The title character of Eloise. While certain parents take offence at her being the Screwy Squirrel, in reality Eloise is shown especially in the adaptations as a caring, generous person, giving gifts to Plaza Hotel employees and the less fortunate.
Both Alexander and Rachael from Fort Hope qualify. They start off as fairly unsympathetic figures, but they redeem themselves by the end of the novel.
Hank the Cowdog from the series of the same name isn't nearly as strong as he boasts he is, as smart as he boasts he is, or as charismatic as he boasts he is...but when the cards are down and someone's in danger, he still charges into battle as though he was.
Severus Snape of the Harry Potter series perhaps walks the line between this and all out Jerkass. He's ridiculously biased towards Slytherin, he has a particularly nasty grudge against Harry Potter and his associates due to the actions of Harry's father, and holds a nearly-homicidal grudge against Sirius Black for his childhood antics. And yet, in the end, he was in fact fanatically devoted to Dumbledore, saving Harry's life and eventually getting himself killed by Voldemort.
The grudge against Sirius Black appears nearly homicidal only in the scene in Prisoner of Azkaban in which he has an emotional outburst at Sirius' escape. However, at the time, he still believes that Sirius is responsible for the betrayal of James and Lily Potter, and so the outburst can be attributed for his life-long love of Lily (Evans) Potter, Harry's mother, another major addition to his "heart of gold" status. His rivalry with Sirius is much tamer in all later moments in the books when he has been assured of Sirius' innocence, even going so far as checking up on Sirius' safety when Harry has visions of him trapped in the Ministry with Voldemort.
Not to mention Sirius tried to feed him to a werewolf when he was sixteen and routinely bullied him, so while it's a bit irrational it's understandable.
Speaking of which, Sirius Black himself fits this trope, as well as his best friend, James Potter.
While not a jerk, Horace Slughorn seems to be rather more concerned about his influence and knowing famous people than being a decent person, as well as being a bit 'old fashioned' (He seems to find the idea of muggle-borns being really good witches novel but to his credit doesn't hold it against said witches and seems to like such a surprise). However, his terrible guilt over what he revealed to the young Tom Riddle as well as his willingness to personally fight Voldemort in the final book show that there's more to him than connections and influence.
Ron fits pretty well too. Despite being considerably nicer than many examples, he is rather hot-tempered and can be incredibly insensitive (especially to Hermione). However, one of the defining traits of his character is his Undying Loyalty to his friends and family.
Hercule Poirot frequently comes over as a vain, arrogant, egotistical jerkass, but underneath it all has a genuinely kind, decent heart.
Mr. Rafiel in A Caribbean Mystery initially comes across as an impossibly rude old rich bastard, but turns out to be a surprisingly kind man under all his bluster. He and Miss Marple become fast friends over the course of the story.
Ford Prefect veers in and out of this trope - he's something of an asshole, but he did save his best friend Arthur from certain death and is passionately opposed to cruelty to any animal but geese.
Despite this, he did at one point (while trapped on Earth thousands of years in the past) take up cruelty to animals as a hobby, and has hinted that he is responsible for the shape of the giraffe's neck.
The Hunger Games: Katniss admits herself that she's not very friendly. There are quite a few times throughout the series where she has angry/rude outbursts. But they are often caused by the various stressful situations she's thrown into and the Crapsack World she lives in. Regardless, she still has a kind heart and would sacrifice anything in order to protect the people that she loves.
And Haymitch Abernathy has a prickly exterior that would put a cactus to shame, and is an unrepentant Deadpan Snarker, but under that, cares about all the Tributes he's mentored, and is part of the underground resistance to the Capitol.
Ronan Lynch from The Raven Cycle. He's a brooding, violent punk who will pick a fight with anyone, but he adopts a baby bird and loves his friends and family dearly (with the exception of his older brother, Declan).
Gabriel Lightwood from The Infernal Devices. He's surprisingly patient with Tessa while training her. Of course his Jerkass side comes out when he's frustrated and he is prone to taking out his anger on other people. He becomes much nicer in The Clockwork Princess when his father is turned into a demon as a result of demon pox and he is forced to stay at the Institite.
In The Long Earth, Lobsang is a very arrogant AI/reincarnated Tibetan mechanic, but ultimately does care for the safety and values the friendship of Joshua Valiente.
Max herself from Maximum Ride. She can be particularly rude and such to other people, but she undeniably cares about the Flock and her mom and biological sister.
The title character of the Mediochre Q Seth Series is an Insufferable GeniusDeadpan Snarker with no respect for anyone except himself and his friends. He is, however, shown to be respectful and considerate to those who are his friends. He has a sort of Foil in the minor character of Professor God (yes, he actually named himself after God), who also has a heart of gold but is so arrogant even Mediochre feels uncomfortable around him.
Sachar in Oblomov. But he doesn't show his good side until his master, the title character, dies.
Harvey in the Origami Yoda books is this. Despite being rude to most of the other kids at his school, he joins them against Rabbski. The others are OK with this, albeit grudgingly.
Willie Woodley from Out of the Easy isn't the nicest person around, however, she does care for the protagonist Josie in a way that Josie's mother, Louise, never did.
Raffe from Penryn and the End of Days, acts aloof and belittling towards Penryn but towards the end of Angelfall, he does stupid things just to help her, up to and including risking his life at gunpoint to return her to her family.
There are many, many world-weary, cynical characters in Boris Strugatsky's The Powerless Ones of this World. While one of them is a genuine Jerkass, the others, despite having grown to be nasty old men that had explicitly given up on trying to achieve anything good or worthwhile with their superpowers, do at least come through to rescue the main character Vadim (a fellow pupil of "the Sensei") from a tight spot.
Mary and Colin themselves. The difference is that they don't end the book that way.
Marcia Overstrand in Septimus Heap. While most of the time she is an annoying bossy complainer, she cares deeply about Jenna and Septimus when they're in trouble.
Simona Ahrnstedt's male protagonists have a tendency to be this. Seth in "Överenskommelser" and Markus in "De skandalösa" are especially prone to being jerks, but Gabriel in "De skandalösa" has his bad moments too. And yet, they always turn out to not be so bad after all...
Older Than Radio: Sherlock Holmes. Can be kind of a conceited asshole (especially toward the police detectives and poor Watson); but he more than once shows genuine kindness and concern for the wellbeing of his clients, and occasionally fails at hiding his genuine affection for Watson (particularly when Watson is hurt or endangered in some way). At one point he gives Watson a large sum of money by purchasing his medical practice for a very high price, but does it secretly through a relative so that Watson only learns of his involvement and generosity years later.
In Space Marine Battles, over-captain Vallax. He's a glory-stealing, egoistic jerkass, but has some (faint) sense of honor and wounds up comitting Heroic Sacrifice to save his men.
When Russell's sister Cheri is introduced in the second Spells, Swords, & Stealth book, she loudly complains about the lack of alcohol, mocks her fellow SS&S players' newbieish choices in their characters, and is more concerned with what kind of loot they'll get. In contrast to the Jerkasses that made up the gaming group from the first book, Cheri quickly warms up to the rest of the group and throws all her support behind Russell when he confides to her his suspicions that there's more than meets the eye in the modules he's been running.
In the Spilling Series by Sophie Hannah, several characters apply, but none moreso than Simon Waterhouse. Yes, he's arrogant, and his best friend Charlie describes him as "weird and frigid and socially inept", but when push comes to shove he generally is a good person and he does care about protecting innocent people, as well as CharlieZailer.
Captain Flint spends most of the first Swallows and Amazons book as an antagonist. Then the Swallows figure out who stole his manuscript (in the process clearing their own name) and he warms up to them considerably.
Time Scout's Skeeter Jackson is a thief and a Con Man who ruined people's vacations, even lives. Of course, he had a little bit of an excuse, but, in the end, he was just drifting. He stole, he gambled, he drank, and he gave most of his money to charity. Wait, charity?
Ripred the Gnawer (read: rat) from The Underland Chronicles is this. He's an antisocial semi-loner with only a small band of outcasts around him, and doesn't respect anyone unless they earn it from him. He has his moments, such as in Gregor the Overlander comforting Gregor after one of the quest members dies and he feels it's his fault, but in Gregor and the Code of Claw, we learn he had a family that drowned in an event described in Gregor and the Mark of Secret. He had a daughter, named Silksharp, that liked to do math puzzles and was apparently not very strong-bodied. Lizzie, the middle child of Gregor's family, reminds her of him. One of the heartwarming moments of the book is him comforting Lizzie in the middle of the night after she has a panic attack.
Rose Hathaway from Vampire Academy is definitely not the most outwardly kind person, though in Blood Promise Sydney comments on how Rose seems so friendly and sociable towards her. She has no trouble insulting people, being Brutally Honest with Lissa, and exposing weaknesses in other people (like revealing the dirt-poor background of Mia Rialdi). Yet she also goes our of her way to protect the people she cares about.
In William King's Warhammer 40,000Space Wolf novel Ragnar's Claw, after the inquisitor tells the injured Ragnor that other Marines have repaired his gear, she tells him that one, Sven, said that he's not an armorer and Ragnar can do it himself next time, whatever the sergeant said. Ragnar laughs and assures her that Sven has a good heart under his harsh manner.
The Amyrlin gave an exasperated sigh. “You remind me of my uncle Huan. No one could ever pin him down. He liked to gamble, too, and he’d much rather have fun than work. He died pulling children out of a burning house. He wouldn’t stop going back as long as there was one left inside. Are you like him, Mat? Will you be there when the flames are high?”
Vivia of The Witchlands is abrasive, easily annoyed, and when informed that her brother has died, her first reaction is one of pure joy, as one more obstacle in her way has been removed. This being said, she's just as dedicated to the wellbeing of Nubrevna as Merik is, gives up food she's stockpiled for the poor of Lovats and is absolutely overjoyed upon learning that Merik is alive, not blaming him for his actions as Fury at all and helping him out the best she can.
Hareton Earnshaw of Wuthering Heights is a rude, boorish, illiterate young man prone to inarticulate outbursts of rage - but he has a hell of a Freudian Excuse (having been raised first by the violent alcoholic Hindley - who tried to kill him at age two by throwing him off a railing - and later by Heathcliff, who deliberately kept him as uncivilized as possible to ruin his life, and mocked and tormented his whole life by almost everyone he meets) - but in the end he's willing to stand up to Heathcliff and he ends up proving one of the more decent people in the book.