This is because that the nerves in the mouth are connected with the nerves in the eyes. When the cold foods such as an ice cream enter into the mouth, the mucous membrance of the mouth will be greatly irritated, which can make the nerves of the palatine feel radiating pain. These nerves then give away this signal to the optical nerves, making the optical nerves contract, thus your eyes will feel pain. In other cases, it is possible that you get a nasosinusitis which can also lead to eye pain when you eat cold foods. If so, you should go to the doctor's for an examination and correspondent treatment.