Hi there,
I work in physical therapy, I am a physical therapist assistant. From my experience this is what leads to believe that back of the knee pain sounds like the hamstrings could be the culprit. However, whenever one joint is feeling bad, another one can get sore due to compensation. Try some gentle hamstring stretching, nothing extreme, you don't want to further irritate it.One stretch that I like if your hamstrings are tight is sitting up against a wall with your legs straight in front of you. I would try icing it as well, however is this is an old pain you can try heat and then stretching, Also try giving your body some rest from the gym for a few days and see how that goes.
I am by no means an expert but these are a few things that we have done for this particular situation.