Took it to the LBS this afternoon. The derailleur bracket was bent, so he straightened it. Then he noticed that the last sprocket was buckled and that the wheel axle is probably bent too. Looks like the bike had a nasty shock into the back wheel, and was subsequently left to rot away in the previous owner's flat for several years - which probably explains why the shifters didn't work until I flooded them with WB40. The LBS has ordered some new sprockets, which will arrive in one week, and we'll see how it looks with a brand new cassette and chain. However, it's possible that I'll need a new back wheel.