you're talking about very low turnout elections that are even more so than normal since both major parties are as popular as the plague right now so even the partisans that'd vote in a local by-election at the start of summer are reconsidering that and that's when you get weird results. Factor in the possibility for the candidate being a strong candidate and its hardly shocking - this sort of thing is what the Libs used to do all the time.
Agreed. I was more interested in what actually happened as opposed to how, just out of curiosity, but you're right.