I think other ideas for comfort would be good too. It IS good that he knows why he wants to eat because we all do that (well most of us, I know I do) eat for emotional reasons at times and I think it would be a good thing that seeing as he understands this that if you at least tried (with no pressure and no expectations for him to understand) to gently explain that when we feel sad or ___ that we shouldn't just eat but we should ____ (fill in the blank with what you want to teach him to do intstead). For example when my oldest gets really upset and dwells on something I tell her that its not really helpful to dwell on it and keep talking about it as it doesn't change the problem but (once we have talked about it and acknowledged it) that she can instead think about other things that are positive (sort of a counting her blessings sort of thing) to help her deal with it. Just as an example of how to guide him to something else. Like you could say "well I am sorry that you feel sad, could you tell me why? Then he talks about it, and then you say okay, well when we feel sad we can ____ (whatever you want to teach). Does that make sense...I don't know how to put it.
As for offering anything like cheese even, I wouldn't personally do it. I would try the giving the snack, then brushing teeth, then going to bed, and if my child was still hungry, I would offer water in a sippy cup, and then offer to lay down with them, and see how that went. I think your concern over the not falling asleep eating because of cavities is completely valid. A child that young cannot understand the problems involved with eating and then getting cavities without brushing because its outside their realm of experience, I would think.
Have you looked into the reasons behind his congestion or other ways of treating it? Like I know you said its allergies but did you look into treating that somehow like removing the allergen if possible or reducing it etc? Not to throw something out there that you've probably thought of but it came to mind.
Oh and I like the other ideas above in the other posts about trying the moist cloth and things like that- cool water cloth/teether is always safe cavity wise.
Also, just so you know, I do think this COULD just be a phase (but its good to also consider other possibilities) because my 3 year old does wierd things sometimes too. Right now she HAS to sleep with certain things and so I just let that go. I have other battles to pick, things that matter. But sometimes as parents we have to draw the line like where safety is a concern and this is one of them- the safety issues of choking or cavities outweighs the child's desires.