Most mode C/S transponder show the FL on the instrument itself. Was that number jumping up and down too? 'cause if it wasn't, then the error is probably in the transponder itself.
But other than that, I agree. It's most likely the encoder or a loose/dodgy wire between the encoder and the transponder.