I have been having these same aches for the past few months and also in the past and until now I have never understood why I have these episodes. Having just read this article: http://www.calmmindpainfreebody.com/painfreebody/hipflexorstrategies/hipflexorstrategies.html I think I can finally make sense of it!
I do a lot of regular exercise and having recently given up running I have started rebounding (mini trampoline). My new regime does not include many stretches afterwards, only may a few obvious ones but I can see now how much I am using the hip flexor muscles and how little attention I have been paying to stretching them out. This would also have been true in the past when I used to use a cross-trainer machine every day. I am also guilty of sleeping with my legs drawn up which also contributes to shortened hip flexors. I am now going to include plenty of hip flexor release stretches following my workouts and perhaps before bed each day in the hope that they help to ease this miserable discomfort. Hope some of you find relief in doing the same.