I have found stretching my hamstrings to be very beneficial to cycling and running.
However, it makes little difference WHEN I do it, and I almost never do it right before or after a ride, simply due to the extra time and inconvenience. I just work it in to my daily/weekly schedule whenever it makes sense.
I do it for the flexibility and range of motion, and that is more of a long term thing. Its not like I am going to suddenly have more flexible hamstrings because I just stretched. I find just being in motion for a little while loosens everything up to its most limber state.