It is more bad luck than anything else however there are actions in the hand that you can improve on. I think the pre flop action is just fine with a raise size that is good that will deter those behind you from getting in the pot. I am not a fan of the flop bet as this board hits a lot of anyone's range and you are sitting here with a pair that is below all cards on the board and also drawing to the ass end of the straight. I think it better here to check behind to control the pot as you now do not want to play a big pot. I understand wanting to end the hand there but those successive cards plus two to a flush make me think with villains calling range that he is going nowhere to your bet. It turns out he makes the worst move possible for us and this is a small min raise. Bigger check raises would give us a fold option here but I think you have to make the call here based on money already in the pot.
The turn is the gin card of all gin cards except 7 of diamonds or hearts would be better. I would be aggressive at this point as you were knowing he could have KQ but more than likely I would put him on two pair or a set. In my opinion you correctly get it in on the turn and unfortunately get drawn out on. Only change I would make would be checking the flop but the way the cards come down I bet top set against straight you are getting it in on the turn even with a flop check back. Bad luck