Imagine no Beatles, it’s not easy even if you try. No Yesterday, no Blackbird, no Sgt Pepper ... and then … no Imagine, no all-time best Bond theme (Live and Let Die), no all-time best comedy band name (Ringo Deathstarr), no Concert for Bangladesh to inspire Live Aid, no Withnail & I, no Life of Brian – but then again, no Charles Manson. In a Beatle-less universe, Mike McGear could be Bono’s producer and best mate and Jeff Lynne is president of the world. Screenwriter Richard Curtis’s goofy, wacky, exasperatingly enjoyable fantasy-comedy riffs on ideas like these with a story co-written with Jack Barth – although it turns out TV’s Goodnight Sweetheart got to the idea first. It is directed with dash and gusto by Danny Boyle.

Maybe it shouldn’t be any sort of evaluative factor, but the simple fact of hearing Beatles songs, the simple thought experiment of pretending to hear them for the first time, does carry a charge. And, although this film can be a bit hokey and uncertain on narrative development, the puppyish zest and fun summoned up by Curtis and Boyle carry it along. It’s ridiculous and indulgent at all times, like Russell Crowe shouting his “Are you not entertained” line from Gladiator wearing a Beatles wig. Yet there is a weird and heavy backwash of sadness at the end, a kind of melancholy comedown, and I can’t quite decide if that was intentional or not.

Best mates … Himesh Patel and Lily James. Photograph: Allstar/Working Title Films

Himesh Patel (from EastEnders and Channel 4’s Damned) steps up amiably and confidently to his starring role as the classic Richard Curtis lovably-hopeless-and-rubbish character with a supportive gallery of friends; he gets a wild stroke of fortune that could never ever happen in real life. But that’s enough about the fact that his best mate is Lily James who is probably in love with him.

Patel plays Jack, a useless bloke from Lowestoft who works in a retail warehouse and has big dreams of making it as a singer-songwriter. On evenings and weekends, he and his guitar show up at awful pubs, gigs secured by his superfan, de facto manager and miraculous quasi-Platonic-but-not-really friend Ellie (James) who has believed in him ever since school when she saw him playing Wonderwall, of all the hilariously quasi-Beatle standards.

But then one night, at the exact moment that Jack loses consciousness due to a non-serious road accident, a gigantic electrical storm lashes across our solar system, frying planet Earth’s space-time-reality-consciousness continuum, and, after a brief power-out, existence has been changed: the Beatles never existed. (This is incidentally every bit as scientifically accurate as anything in Christopher Nolan’s Interstellar.) Jack realises that he is the only person unaffected. He is the only human being who remembers the Beatles songs and can pass them off as his. And so his climb to super-mega-greatness begins.

Saboteur … Ed Sheeran with Himesh Patel in Yesterday. Photograph: Jonathan Prime/AP

There are lots of laughs and goosebump moments, especially when Jack plays his new song Yesterday to his saucer-eyed mates, and later realises he has to frantically piece together the lyrics for Eleanor Rigby from memory because Google can’t help. Ed Sheeran has a nice good-sport cameo as himself, as the big star who discovers Jack and then has to come to terms with the fact that he is Salieri to Jack’s Mozart; and, in all his mediocrity, he winds up attempting to sabotage Hey Jude.

Arguably, the story as it pans out is a bit straightforward: there is no question of, say, some Beatles songs going down better than others in the present day. Moreover, Curtis scholars will see how Yesterday is a gender-switch version of Notting Hill, featuring an ordinary guy getting a brush with uber-glamour, with Joel Fry in the Rhys Ifans role of stupid best mate. There wasn’t much for Kate McKinnon to get hold of in the role of the nasty LA manager, but the onward rush of silliness compensates.

Of course, we’re heading for a colossal final cameo(s), and I was reasonably sure I knew what form this was going to take – but I was wrong. This big walk-on moment is every bit as sentimental and extravagantly sugary as everything else. For the first millisecond, though, it really will take you aback. As fab as it could reasonably be expected to be.