This happened to Ruby and I a few months ago (it was the wee hours of the morning here as well ). Luckily, there's a 24hr emergency vet nearby which I was able to call. I don't know if Jasper is on any special diet, but the vet recommended that I feed Ruby some soft oatmeal (cooked, obviously) and if that didn't stop the hacking to bring her in. Well, it didn't stop, I went to the emergency vet (around 1am). They did some x-rays and it ended up being nothing serious (an enflamed trachea). They just said to keep an eye on her for a few days and she'll be fine - which she was and is

Sounds like Jasper is on the up and up. Hope it stays that way. Maybe try the oatmeal if he's still hacking? HUGS to you both