Silver Linings Playbook has a suitably upbeat title and several of the key ingredients for a standard Hollywood "feelgood movie" – an oddball hero returning home to make peace with his family, an encounter with a kookie girl whom he ends up chasing through the festive, snow-flecked streets at Christmas, a couple of public contests (a dance and a football game) on the results of which the future depends. And indeed the movie does make you feel quite good about humanity as the final credits roll. But this is a David O Russell movie, his sixth since 1994, and for him feeling good is the reward for completing an emotional assault course.

Russell made his debut with Spanking the Monkey, a sparkling comedy about a middle-class lad on the threshold of leaving home to enter medical school, who develops troublesome incestuous desires for his attractive, invalid mother (as well as a Portnoyesque obsession with masturbation) when left to care for her by a domineering father. In the years since, Russell has gradually moved into the mainstream without abandoning his oblique approach to the world, his interest in self-questioning heroes and his fascination with dysfunctional families. The latter can be actual, as was the case in his last and most seemingly conventional picture, The Fighter (his biography of welterweight boxer Micky Ward, from a rough Irish-American background) and the absurdist comedy I Heart Huckabees, his one notable failure, where the family is Bush's post-9/11 America.

Perched on a razor's edge between comedy and psychological drama, Silver Linings Playbook opens with the release from a mental institution of the explosive Patrick Solitano Jr after eight months' incarceration. He's played by the handsome Bradley Cooper, currently best known as one of the carousing tourists in the calculatedly vulgar Hangover movies. He's been diagnosed as bipolar after beating up a fellow high school teacher, whom he found, we graphically discover, having a shower with his (Pat's) wife.

The condition of his release is that he takes his medication and lives with his father (Robert De Niro doing another of his querulous pater familias roles), now running an illegal bookmaking business in his parlour, and his devoted mother (fine Australian actor Jacki Weaver, most recently seen here as the Melbourne gangland matriarch in Animal Kingdom). Meanwhile, he must keep clear of his estranged wife and make regular visits to a perceptive, pawkily humorous Indian psychiatrist.

All of these people are obsessives of sorts, but plausibly so, as are the majority of the people Patrick meets in his native Philadelphia suburb. A particular passion they all share is for the local football team, the Philadelphia Eagles, which somehow they manage to identify with America itself and with Benjamin Franklin, the city's greatest son. Because of the tradition of disruptive violence his over-enthusiastic presence encourages, Pat's father has been banned from the Eagles' stadium.

Most significant among these people is the young widow Tiffany, a good-looking woman living in the garage of her parents' home, which she's turned into a dance studio. An old school friend of Patrick's, she hilariously reunites with him over dinner as they exchange notes about the medication they've been taking. Her project is to involve him in an annual dance, the city's local equivalent of Strictly Come Dancing and named after Franklin.

Tiffany is another version of the tough bartender and college drop-out in Russell's The Fighter who sets out to rescue the failing boxer from the family that is destroying him. Both are familiar characters in Hollywood comedies, but the fundamentally sensible Tiffany is given a rare depth and pathos by Jennifer Lawrence. She bonds in a complex way with Pat by giving him a pejorative, one-minute summary of Lord of the Flies before throwing it out into the street. This echoes a literally shattering scene earlier on when Pat reads the high school syllabus his wife is currently teaching, is driven crazy by the wilful pessimism of the end of Hemingway's A Farewell to Arms and throws the book through a closed window. Perhaps the message of this strand of the narrative is to carry on with the medication but be careful what you read.

The great strength of Russell's writing and direction resides in the way he consistently manages to retain a comic tone without losing touch with the characters' pains and anxieties. There are numerous scenes that in other hands would be as excruciatingly embarrassing on the screen as they would be in real life: a row in a diner, for instance, that spills out into the street on Halloween night and involves a crowd in fancy dress outside a cinema. But Russell involves us so closely in what we're watching that we become emotional participants. And that's because he cares for these people in a wholly unpatronising fashion.

Perhaps the film is a trifle over-egged towards the end and comic seriousness briefly turns into unfunny solemnity when it deals with the reunion between Patrick and his more conventional brother. But that's a minor criticism of a hugely enjoyable film.