If you are "terribly hungry" - eat. And it is better, of course, not to lead to this. Eat healthy and low in calories, but don't go hungry. A slight feeling of hunger is acceptable if you are used to overeating, but not terrible hunger. Try to eat often and in small portions. Distribute your food evenly among your waking hours, include healthy snacks. It is better to finish eating 3 hours before bedtime, but if you are awake before 2 am, the principle of "not eating after 6" is not for you.
If you go hungry, you risk undermining your healthy metabolism. In addition, it is difficult to fight the wild desire at 2 am to eat all the most high-calorie in the house, preferably with bread, having a snack with dessert. It is much more effective to stick to a healthy diet and eat evenly throughout the day in good control.
Plus, if you exercise, make sure you have enough energy to do so.
Food for the night is very much postponed. The only question is that it's also hard to fall asleep on an empty stomach. If you suddenly wanted to have a snack at 2 am without harm to your figure, there are two universal dishes - cottage cheese and boiled egg whites. Can be together or separately. Pure protein with a minimum of deposition.
Recent studies indicate that it doesn't matter what time a person eats. For a figure, for example, it is not even the daily, but the weekly calorie content of the diet that is important. If you are hungry, if you have not eaten for a very long time, then you can eat even at night - this will not affect your figure (provided there is no overeating) or health. If you feel comfortable falling asleep in sweat with a full stomach, then eat to your health.