Melissa McCarthy’s choice of projects hasn’t been particularly astute of late, but she hits paydirt with “Can You Ever Forgive Me?,” a deliciously down-and-dirty portrait of Lee Israel, a failed author who overcame her writer’s block, after a fashion (and solved her financial woes to some extent), by forging collectible letters supposedly written by dead celebrities and selling them to unsuspecting dealers as the real thing. Catty in every sense—from its human characters to its scabrously funny dialogue and the fact that one of its major performers is an actual feline—the film, sharply written by Nicole Holofcener and Jeff Whitty and skillfully directed by Marielle Heller, provides McCarthy and co-star Richard E. Grant with their best roles in years and winds up a thoroughly engrossing dark comedy.

When we meet Israel, it’s 1991, and after a couple of moderately successful books she’s embarked on a biography of Fanny Brice that her agent Marjorie (Jane Curtin) tells her there will be no market for even if she manages to finish it—something that seems doubtful, given that she can barely manage to type a single word. (When she overhears Tom Clancy, played by Kevin Carolan, pontificating at one of Marjorie’s parties that writer’s block is just an excuse for laziness, you can see in McCarthy’s eyes Lee’s urge to punch him out.)

Israel lives in a squalid NYC apartment she shares with her only friend, her beloved cat, which she allows the run of the place (even—as we will see—the use of the area under her bed as a litter box). The animal is sick, but Lee can’t afford an appointment with the vet any more than she can her own rent (her imploring super, played by Gregory Korostishevsky, keeps begging for payment). She begins selling off books at second-hand shops to try to get a few bucks together. Israel is obviously in a bad place, and her scowling, sarcastic manner doesn’t help, even though while drinking away the day at her favorite watering hole (presumably on a growing tab) she encounters a kindred spirit in the aptly-named Jack Hock (Grant), an ostentatiously swishy, utterly disreputable British gent who commiserates with her over tales of parties they both once attended.

Then the proverbial light bulb goes off. In doing some desultory research on Brice in the library, Israel finds a couple of letters from the performer tucked into one of the long-unread books, pockets them and sells one to a sweet bookseller, Anne (Dolly Wells), who’s actually kind to her and obviously looking for friendship herself. (We eventually learn that Lee’s long-time lover Elaine, played by Anna Deavere Smith, left her some time ago because she was too high-maintenance in the emotional department.) To increase the value of the second, Israel tacks on a witty typewritten postscript that makes it more personal, and thus more desirable to collectors.

Realizing there’s a market for such stuff, Lee goes into self-training as a forger, procuring some old typewriters, getting together the right sorts of stationary and learning how to age the results to make them look authentic. Being a natural-born researcher, she can collect data on people like Noel Coward and Dorothy Parker to give her products the verisimilitude they require, and then approach dealers like prim Paul (Stephen Spinella) and greedy Alan (Ben Falcone, McCarthy’s husband) to sell them as purported inheritances from relatives. Not too many questions are asked, since the hope of profit can blur principles on all sides.

The business grows to such an extent that Israel requires a partner of sorts, and Hock is happy to play the part and step into the salesman role when Lee has become too visible—or suspect. He also suggests a wrinkle to the enterprise: Israel could substitute her copies of actual letters for the originals in archives, sell the real thing, and no one would be the wiser. It’s a scheme she tries at the Yale library, and it succeeds despite the watchful gaze of the chief librarian (Sandy Rosenberg); but it also proves her downfall, since in her absence from the city Israel has left her place (and cat) in the care of Jack, whose dalliance with a handsome busboy (Christian Navarro) proves disastrous and leads to the collapse of their partnership. Worse, it invites federal investigation of Israel’s little racket and leads to her indictment and conviction. Happily the sentence (delivered by a judge played by Mary B. McCann after a delicious not-quite-remorseful statement from Israel) only requires probation, and it’s soon clear that Israel does not feel bound by its restrictions. In fact, she goes on to write a book about her forging career that becomes her biggest professional hit.

McCarthy seizes on the possibilities of the script and plays this brash, colorful character to the hilt. She communicates Israel’s emotional insecurity, especially in the quasi-courtship scenes with Anne, to whom Wells brings palpable vulnerability, and her reunion scene with Elaine, played with affecting simplicity; but she especially revels in the writer’s pushy, domineering side, ripping into people at the slightest provocation and only later showing signs of regret at having burnt another bridge. Grant goes even larger than McCarthy does, clearly relishing the opportunities Hock offers for grandiose gestures and explosions of juvenile delight. The supporting cast offer gemlike cameos, with Curtin standing out as the long-suffering Marjorie, who’s accustomed to the desperate Israel’s penchant for petty theft.

The film is also successful in capturing the seedy New York atmosphere in which Israel lived, as well as the genteel but slightly decadent ambience of the world of collectibles into which she entered in a spirit of larceny that doesn’t seem all that out of place. (At one point, when told that a letter boasts a certificate of authenticity, she asks who authenticates the certification.) Stephen Carter’s production design, Sarah E. McMillan’s set decoration and Arjun Bhasin’s costumes are spot-on. And while Anne McCabe’s editing accentuates Heller’s sometimes overly permissible attitude toward the actors, allowing scenes to run on a bit long, Nate Heller’s score, interpolating some golden oldies like Henry Mancini’s “Charade,” adds to the sense of rightness.

In fact, “Can You Ever Forgive Me?” paints such an indelible portrait of this brusque, reckless, caustic, but deeply sad woman that you may be be willing to forgive McCarthy for the many comic misfires she’s foisted on audiences in the past few years.