Hi there...sorry to hear that your dog is not well.
I think all of the problems stem from the possible liver shunt. When this happens, the blood supply that is supposed to go through the liver does not. This means that a lot of nutrients that should be supplied by the liver are not being supplied and the detoxification that is supposed to happen does not happen. So, often these dogs have great difficulty in gaining weight.
I have had several dogs who have had a shunt who have survived surgery and now are healthy plump dogs. However, the surgery needs to be done by a specialist and would likely be quite pricey (like $2000-$4000).
There are some foods that are made for dogs with liver problems such as Hill's l/d which is a prescription food that your vet can order for you. You can also inquire about certain supplements such as sAME and Milk Thistle and lactulose which will help the liver to function better.
The other thing that you can look at is whether or not there is another condition present which could contribute to the lack of weight gain such as intestinal parasites.
You could also ask your vet to prescribe some anti-nausea medication that you could administer an hour before feeding him to help him to keep the food down.
Unfortunately dogs who have liver shunts do not tend to live a long time unless they have surgery.
You can read more about this condition here:
I hope this helps. If you have more questions just hit reply. I'll be in appointments all day so I may not be able to respond right away. Or, if my answer is sufficient please hit accept.