Not sure but I have had that pain – last year when I was running to get ready for the Gt Bentley 1/2 marathon and overdid the training – it gradually went with time.
I think pains like that are often due to an imbalance in the strength of the muscles (or maybe tightness of the muscles) of the leg – I have very tight hamstrings, as do most cyclists and runners.
I good book on stretches is “The Stark reality of stretching” – all lower body stuff and apparently he is well regarded.
The best stretching for cycling for me is to actually stretch the gluts, so I try to touch my toes but keeping my back straight as I bend rather than ending up like a question mark. Watch women, this is how they bend over…
Spin the pedal if you can, rather than pounding the pedals as this puts a lot of stress through the knees.
If you are bandy legged or similair and use clipless you might consider if you need canting, like ski boots. Otherwise make sure you have lots of float – maybe with Time Atacs, CBs or Look 4.4s.