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.
Your eyes hurt may have no relation with your ice cream. Your eyes may get infection. The invisible bacterium may come into your eyes. You need to use some eye drops to moisture the eyes. You should also use the warm compress to make your eyes get comfortable and moisture. You need to use the home remedies to protect your eyes.