There is no reason why you shouldn't eat shortly before going to bed as long as you remain within your nutritional requirements for the whole day. There has been no study I'm aware of that has shown any correlation with food timing and body composition. There is a clear correlation with body composition and food content. The biggest concern is with sleep quality and food content.
There are reasons to eat after exercise:
- To replenish your glycogen stores (energy in your muscles)
- To aid in recovery--if your body has the raw materials necessary, it can do it's job better
Assuming you are getting your daily requirement of protein throughout the day, the biggest need your body has after exercise is carbohydrates. Post exercise is the safest and most useful time to eat carbs. The majority of the energy is put into your muscle, which aids recovery.
The problem is that you need to find a carb source that won't affect your sleep. Now is not the time to get that super spicy deep fried chimichanga. You definitely want to avoid anything that is likely to give you heartburn. Also, you don't want something that will turn to liquid and wake you up at 3:00am with an urge to urinate. That rules out frozen treats like ice cream and most shakes (protein or otherwise). You know your body best, so try different things to figure out what works best for you.
It can be useful to save the vast majority your daily allotment of carbs to post training. This ensures you don't overeat for the day, and it addresses the recovery issue nicely.