You bluffed it, well done...but as to what you were thinking, who knows?
What exactly do you put him on given the action? Its unlikely that he had the nut straight, as he only called your CR on flop, and flat your turn bet. So it looks like he was on a draw or a set. Now a flush here would be unlikely to raise you at river given the paired board, so he wa representing a set which filled up, which is consistant with the action so far. But somehow, you decided that you would not back down with air, and pushed, and somehow, he folded. I'd say he was either floating flop/turn to bluff scare card, or made a bad laydown with a small flush.
Now, why was his river fold bad, if he had a small flush? After all, it was a paired board. Well, what did he had you on? You CR the 3 card straight flop, led the turn, and led the river when the board had changed. Would you really be doing that with middle set/two pair on that board? Really? So your logical hand is a flopped straight, maybe with a FD. Would you really be reraising at the paired river with a flush? Highly unlikely. So unless you had something like TJQK/TTJQ/JQKK/9JQK (which seem unlikely given the preflop action), he was way ahead of your range, as you either had a very unlikely full-house, or was, more likely, bluffing.
But hey, you made it. WP, or something like that!