First, while we can see hairballs cause nausea and gagging in cats, it rarely causes nausea severe enough to put them off eating and drinking. So, while it a hairball could play a role here, I'd be more concerned that he could have a non-related bacterial or viral gastroenteritis, pancreatitis, parasites/protozoa infections, or ingestion of harmful items (ie toxins, plants, non-edible items).
With this all in mind, as long as he can keep water down, we can try some home supportive care to try to settle his stomach. To start, hasn’t just vomited (since otherwise we’d need to rest the stomach for a few hours first), you can consider treating with an OTC pet safe antacid [ie Pepcid (More Info/Dose @http://www.petplace.com/article/drug-library/library/over-the-counter/famotidine-pepcid), Tagamet (More Info/Dose Here @ http://www.petplace.com/article/drug-library/library/over-the-counter/cimetidine-hcl-tagamet)]. Whichever you choose, we’d give this 20 minutes before offering food to allow absorption. Of course, do double check with your vet if he has a known health issues or is on any medications you haven't mentioned. Also if you give this and he cannot keep it down due to nausea that is usually a red flag that we need to bypass his mouth with injectable anti-vomiting medication from his vet.
Once he is more settled, you can plan to try small meals of a light/easily digestible diet. Examples you can use are boiled chicken, boiled white fish, scrambled eggs, or meat baby food (garlic/onion free only). The aim of these diets is that they will be better tolerated/absorbed by the compromised gut. Therefore, it should get more nutrients in and result in less GI upset. Whichever you choose, you can add OTC cat hairball gel/paste to this or give it directly to help move any hairballs into the stomach to at least rule them out. As long as improvement is being seen, I usually advise continuing this until the signs are settled, and then weaning slowly back to what you normally feed.
Since dehydration is a risk with his lapse in drinking, we need to keep an eye on his hydration. To check this and make sure dehydration isn’t an issue, there are a few parameters you can test. Further to checking for gum moisture, you will want to make sure his eyes are not looking sunken and that he doesn’t have a "skin tent" when you lift the skin. To see how to check these, you can find a good video HERE (http://www.ehow.com/video_12232503_dog-dehydrated.html). If you do see any of these signs already, then that would be our cue to have him seen before this becomes an additional issue (especially since its often dehydration that makes them feel unwell).
Overall, a wide range of agents could trigger the signs we are seeing. Hairballs usually won't cause signs this severe, but we can try to reduce nausea with antacids to then see if we can treat for that and get him eating. Though if he cannot keep that or water down, appears dehydrated already, or doesn’t respond to the above within 12-24 hours (since we don't want to risk him developing secondary liver issues from his self-starvation); then we'd want to get his vet involved. They can assess his hydration, rule out fever, ensure nothing in his stomach that shouldn't be, or any sinister viruses present. Depending on their findings, his vet can treat with injectable anti-vomiting medication, fluids, +/- antibiotics to get him back feeling like himself.
Please take care,
If you have any other questions, please ask me – I’ll be happy to respond. **Afterwards, I would be grateful if you would rate my service by clicking on the "Rate my Expert' button at the top of the page as this is the only way I am credited for helping you. Thank you for your feedback!: )