Heya, I had something like this a few years ago, one day I just randomly started to feel really sick and I'd be up all night in the bathroom convinced I'd be sick but I never ever was. It was put down to stress (as at the time, despite only being thirteen, I had a LOT going on- I had school, 4 dance lessons a week, plays to rehearse for during lunchtime and after school and half term and also had to go to all these advanced maths and science classes during lunchtimes to take level 8 SATS or something.. ridiculous!)
But it didn't feel psychological at all, it felt very VERY physical it was so real in my mind. Anyway it sort of escalated in a way, in that I then began to feel sick espescially when I was having anxiety attacks, which were ironically, brought on by the illness because I'd get them at the thought of leaving the house- because I would always be scared I'd go out and start to feel really sick and be sick and not be able to get home.. was evil!
It lasted, all in all, about a year and a half, in which time I was half going to school. And what got me over it in the end was I had to have a clinical psychologist who helped me understand what caused the problem and helped me to tackle it by doing relaxation technuiqes. Also my school were really supportive because they said if I was in school I could leave lessons any time I wanted and sit in the 'comfy-space' type thing, or I could go home any time I wanted which really helped with the whole 'I can't leave the house or I'll be in a trapped situation!' type thing..
So my advice to you would be to try and relax, when you start to feel ill don't dwell on it. Breathe deeply, lie down on your bed, listen to some relaxing music and just try and let go of those thoughts of your ex etc. And if it does get worse try speaking to someone, you can always get real help if it turns into a very big problem.
Good luck XXX