Do people really get nightmares from eating late?
Medical conditions that wake you up can potentially lead to increased recall of dreams—including disturbing ones. A person who wakes up during the dreaming phase of sleep is "closer" to the dream and will therefore recall it more vividly. As for late-night eating directly causing nightmares, small studies of individuals who ate immediately before sleep have not shown a consistent relationship.
However, nocturnal eating can interrupt your sleep in various ways, prompting recall of disturbing dreams by the mechanism described above. For example, eating a large meal, especially a high-carbohydrate meal, could trigger night sweats because the body generates heat as it metabolizes the food. Also, gastroesophageal reflux (GERD), caused by lying down with a full stomach, may trigger symptoms that wake you up.
Eating late also has a possible health impact unrelated to dreaming: Increased calorie consumption—from eating snack foods in addition to the day's major meals—can end in weight gain. There are certainly good reasons to avoid nighttime foraging.