This happens to me as well, it’s quite common. It is most likely due to the fact that the hamstring is in a shortened position and you haven’t spent a lot of time there. Especially if you smoked them in a workout the day before its not surprising they cramped up. If I keep cramping I usually throw in some soft tissue work and do a little warmup beforehand to get some blood flow to the area. You could also try adjusting your position slightly or try a variation like a 1/2 kneeling banded hip flexor stretch so that hamstrings aren’t in such a shortened position.