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.
James Adams in the CHERUB series fits this trope nicely.
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.
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.
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.
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.
Hercule Poirot frequently comes over as a vain, arrogant, egotistical jerkass, but underneath it all has a genuinely kind, decent heart.
Ford Prefect veers in and out of this trope - he's something of an asshole, but he did save 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.
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.
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.
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.
Both Florida and Tiller from Sharon Creech's Ruby Holler. They bond because of their similarity.
Gideon from The Ruby Red Trilogy. Charlotte sometimes shows a softer side as well, though she's usually a very cold person.
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...
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.
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.
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.
In the "Spilling Series" by Creator/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.
Several characters in Chronicles Of Magic; most notably being Skeeter Traps, who tends to show her concern for others via punching and insulting them.