Well first of all your river bet was correct. Your opponent raised pre and then bet 2 streets. Villain could easily be in check/call mode with a big pair, but it's not that likely
another possibility is that villain decided to bet a pair for 2 streets of thin value and then transform their hand into a bluff when the flush card hit
when you flat both streets your hand becomes a bit transparent, and IMO villain might have recognized that you were value betting less than the nuts on this board
You were just deep enough to make this move viable.
The problem with calling is that your not beating the value range of a check raise. You have a bluff catcher, so you have to decide based on pot odds
how often your opponent does this with nothing.
some % of the time its full house, a much smaller % of the time its bigger flushes, and a good % of the time you have the best hand
I think based on player stats folding is the best option, but I think a strong case can be made for calling - it's a really marginal spot either way, so whether you fold or call there is still thin value/loss in the long run