Talk about the world turned upside down. First it's a heatwave in October. Now it's a new Woody Allen film you actually feel glad to have seen. Already well-received at Cannes, Midnight in Paris did such good business in the US that it qualified as a hit. It would be easy, too easy, to call it a "return to form" – as some wishfully did of Vicky Cristina Barcelona – and thus blank a decline, which in the last 10 years has sometimes felt like a terrible cosmic joke. This film, Allen's 41st, is no masterpiece, but it's blessed with a sense of fun and a genial tone that seemed to have vanished from his work for good.
Much of its appeal resides in the casting of Owen Wilson, who plays the surrogate Allen figure better than any other actor has done. Rather than imitate the famous repertoire of gulps and stutters, Wilson uses his Texan drawl and easygoing vagueness to suggest his master's mood, namely the air of wistful romanticism that became so beloved in the likes of Annie Hall and Manhattan. He plays Gil, a West Coast screenwriter holidaying in Paris and hankering for the good old days of his literary heroes, Hemingway and Fitzgerald. So besotted is he with the city that he's been trying to write a novel, to the petulant disapproval of his fiancée Inez (Rachel McAdams), who's here with her pretty awful parents (he's a Republican fatcat, she's a grabby antiques hunter). Gil, feeling misunderstood, is further estranged when Inez takes up with a smug American expat and know-all (Michael Sheen), a stock Allen figure who reached his apogee of unpleasantness with Alan Alda's roll-necked pedant in Crimes and Misdemeanours (1990).
Left to his own devices, Gil goes mooching about the nighttime Parisian streets ("Paree-zhun", as these Americans pronounce it). One evening, as the bells strike midnight, a lovely old limo swings by and a couple of partygoers invite him to join them. This pair, introducing themselves as Scott and Zelda Fitzgerald, whisk him off to – mon Dieu! – the 1920s city of Gil's dreams. Scott (Tom Hiddleston) introduces him to Hemingway (Corey Stoll), who in turn invites him to the salon of Gertrude Stein (Kathy Bates), and suddenly the excitement of the Jazz Age blossoms around him. Could it be that Gil, the eternal nostalgist, is fantasising it all? Allen doesn't trouble to consider the hows and whys, preferring just to run with the conceit and see where it takes his hero. Principally, it takes him into the company of a beautiful sprite named Adriana (Marion Cotillard) who's been muse to some of the art scene's great and good. "How long have you been dating Picasso?" asks the wide-eyed Gil, hearing the absurdity of the question as soon as it's out of his mouth.
Where the comic rhythms of Allen's recent work have felt woefully out of joint, this one is frisky, fleet-footed and sometimes very funny. It is a brilliant touch that when Gil finally tries to explain his bizarre time slippage, he happens to choose Dali, Buñuel and Man Ray for his audience – three surrealists who find nothing odd about his story at all. The one thing I don't think we can call it, though, is fresh. Allen is revisiting the glorious time-travel comedy of his 1977 short story "The Kugelmass Episode", in which a literature professor suddenly finds himself a character within the pages of Madame Bovary. It's also a variation on the metaphysical games of his later movie The Purple Rose of Cairo, where a forlorn waitress in Depression America is offered an escape into the fantasy of the cinema screen. Allen may also have had in mind Alan Rudolph's great film The Moderns, a parable about art and forgery that was itself a woozy pipe-dream of Paris in the 1920s, with similar walk-ons for Hemingway et al.
The frothiness of the film turns out to conceal a mildly serious point about our attitude to the past. Gil, absorbed in his romance with the Jazz Age, is amazed when Adriana magicks them even further back to the 1890s and introduces him to Lautrec, Gauguin and Degas: for her, the Belle Epoque is the one they ought to be inhabiting. This is the fallacy of "golden-age thinking", in Allen's view, the temptation to regard any era but one's own as the place to be. Gil's attachment to the past is primarily an artistic one, though it might also be a displacement activity for what's going wrong with his present – namely, a fiancée who doesn't get him. Rachel McAdams highlights a recent feebleness in Allen's writing as she degenerates from impatient onlooker to a caricature of US charmlessness, ready to accuse a hotel maid of theft on no evidence, and then casually confessing to Gil that she's just betrayed him. That her dad has put a private detective on Gil's nocturnal traipsing is a liberty too far, even with its cutely surreal payoff.
If it is too late to expect another great Woody Allen film, Midnight in Paris is nevertheless a surprising event, the surprise being that he's still capable of grace, lightness, wit. The smart comebacks may not have the zing of old – "Have you ever hunted?" Hemingway asks. "Only for bargains," replies Gil – but they have enough about them to raise a chuckle. I accept that four stars is perhaps one too many for this slender jeu d'esprit; divide the extra one between a bonus for Owen Wilson's performance, and a tentative hope that the film won't prove to have been a complete fluke.