Nostalgia is a feeling I try to avoid. Even so, I couldn't help a pang while re-acquainting myself with Straight to Hell – director Alex Cox's berserk homage to Sergio Leone made back in distant 1987, a tribute to the spaghetti western so grubby it had blood and pasta sauce down its shirt, which is now the recipient of a polished-up DVD reissue complete with once-deleted scenes restored. It's no one's idea of a lost masterpiece; it's far from its creator's best work; and yet it's still in some small, strange way a landmark.

That said, I think we can be confident there will have been little thought while the film was being made that it would be the subject of critical pondering 23 years later. While occasionally hugely enjoyable, the whole thing is the definition of throwaway, and the plot's portrait of a trio of bank robbers taking refuge in a dusty ghost town is the flimsiest of pretexts for a series of deadpan riffs on guns, caffeine and sexual jealousy. But plot was never the selling point here – that was the then all-conquering Cox, and the cast he assembled in Leone's old Spanish stomping ground of Almería. From his deathless debut Repo Man came the jittery Dick Rude and laconic Sy Richardson, joined by the comebacking Dennis Hopper, a young Courtney Love, and a ragbag of rock stars including Elvis Costello, Shane MacGowan and, in the lead, Joe Strummer.

Written in three days, shot in three weeks and widely loathed on release, the film now reveals what might best be described as a wilful sloppiness. But it's hard not to be charmed by the freewheeling energy and genuine oddball sensibility (for all the bloodshed, the closest thing to foul language is an invitation to "go boil yer 'ead"), while Strummer in particular is unexpectedly great. The result is, if nothing else, an interesting halfway house between the sardonic glee of Repo Man and the Central American odysseys of Walker and Highway Patrolman, three films that provide the bulk of their director's finest moments.

Yet the really striking thing about re-encountering this parched romp in the bitter final weeks of 2010 is the gulf between today and the era from which it sprang – watching it now, it feels as distant as a silent movie. Part of that is probably down to the period being the all-but-forgotten high watermark of Cox's career, his success with 1986's Sid and Nancy meaning he could casually wave away job offers from Hollywood – this time missing the chance to direct Steve Martin in Three Amigos, disappear into the desert to piss about with his friends and have the results released into cinemas worldwide.

But still more anachronistic might be the film's sense of being part of what was, however quaint it sounds, a true counterculture, influenced by and bound up with punk rock. It was a mood expressed in, for instance, the edgiest stretch of Martin Scorsese's career (notably The King of Comedy with its cameo for Strummer and the rest of The Clash and After Hours with its Bad Brains interlude), and the green shoots of an independent-minded new school that included Cox alongside the likes of Jim Jarmusch, Spike Lee and the Coen brothers, still then spiky weirdos rather than literary adapters and remakers for hire.

And if the circumstances of the film being made owed much to such a quintessentially 80s cause as declaring solidarity with the Sandinistas, then it also came out of Cox embracing the role of film-maker as someone who simply hustles up a tiny budget, packs his camera and heads off into the unknown. I know that his funding occasionally came from Universal Studios – but I still can't think of many directors who more deserved the title of guerrilla film-maker, making only the movies he wanted to make on only the terms he felt comfortable with. Whereas now, in some quarters, that phrase has simply come to mean making hugely commercial projects on the cheap – not so terrible an ambition, but not quite the same thing in polarised times like these, when the prime minister's chipper brief for British directors is to help promote UK tourism. Like I say, it's not good to give in to nostalgia. Sometimes, though, it's unavoidable ...