Ok everyone's gonna say it, fold that garbage preflop especially to a raise even if it's a mini.

But anyway, here's what I see him thinking. He hit his set but sees a flush draw on the board. Sees you're both ready to play with the $2 bet and call post-flop and decides to take it down right there. Nope, $5 bet isn't enough. Turn comes, double flush draws out there. Doesn't want to make the same mistake again with too small of a bet, so hammers a good one out, you bite and pay the price.

I really don't think it's that wierd of a hand. If I were in his spot I would have played it exactly the same minus the pre-flop raise.

But the moral of the story in this hand for you is: fold pre-flop, fold post-flop, and fold turn.