After a couple of evenings completely stripping and cleaning the bike, including some rust removal (aluminium foil, what a revelation!), then putting on the new cog, ring and chain, the bike is sorted.
At least, the back end is. I still need to do something about the front, but that can wait...