Except that isn't what happened, either time.
It isn't luck, he blatantly wanted Wang to hold the mechanism in place to stop Dio from ever making landfall - killing everything on board so the world didn't end, never once was it implied it was luck, in fact Dio straight up states the Hamon ****** with Wang's mind. In fact, Jonathan himself states that he can't even kill a zombie in his state, but, what he will do is good enough. Dio then says that instead of destroying him, Jonathan opted to mess with his mind and Wang is being controlled into grabbing the mechanism. Jonathan then tells Erina that he's gonna make the ship explode through Wang.
And the snakes? Jonathan himself straight up says what he's gonna do before he even does it.
"I'll send in a little Hamon to make the snakes go crazy". Aka, he deliberately and consciously chose to induce madness in them via Hamon.
You don't sound so sure, I didn't ask if the drive was mechanical, that's obvious, but we don't need to see if he has a brain or not to assume he has one, we need reason to believe he doesn't have one at all. Is he cybernetic? If he's cybernetic it stands to reason some of it is organic still.
I should also mention, Hamon can be conducted through metals (See Jonathan's own Metal Overdrive).