It could also be argued that he may have been eating non-dairy ice cream in that scene. Lactose intolerance (and other dairy-free lifestyles like veganism) are fairly common, so I wouldn't be surprised if the SGC food stores had non-dairy varieties as well for those individuals who don't want "normal" ice cream. We certainly don't get a clear enough view of the label to see exactly what it is he is eating. They just call it "the frozen stuff" here.
But I agree, the better in-universe assumption is that he had just learned his lesson after eating dairy for the first time. With that said, I assume the real-world explanation is that that was actually just a mistake by two different Stargate writers not coordinating stories.
