My mini aussie has severe food allergies, SEVERE! She is extremely picky about food since she associates much of it with her pain/discomfort. She will throw up clear bile/ phlegm when she feels off and won't eat, most likely the phlegm is due to an empty belly. I think you are probably correct about the empty stomach, but the cause may be more than just ulcers. I would strongly suggest having a blood panel for allergies sent out to be done.
My poor girl was stressed with everyone visiting for a week and since SIL was not a dog person, I think it stressed her out even more. She is now off of her science diet prescription dog food for severe allergies, my only choice was to start making home made food for her using things I know she tested okay for. Right now she is eating chicken and oatmeal. Not the most balanced diet, but at least she is eating it. A calorie is a calorie, at least she can digest it. She can't afford to loose any more weight. It is either that or she doesn't eat all all. There are foods that she tested okay with, but they seem a little too rich and cause her to get an upset belly anyway....it's very difficult and frustrating, she can not digest rice very well, eventhough she tested ok for it, eggs don't sit we'll with her either, but she can supposedly eat them.