Villain's bet makes very little sense. With a set or top 2 pair, we'd expect a value-raise then a river shove. An ace or jack we expect to call or maybe fold. Guess he can play 27,AK,AQ,a set like this & be trying to represent a bluff. But unless you've seen him pull shit like that before, it's unlikely. Good call imo.
I'm pretty sure I've called off in spots very similar to this based on reasoning very similar to this approximately 47,922 times, and been shown the nuts (or, a slightly better hand) at least 47,921 of those times. Doesn't mean it's bad reasoning.
Awful play by villain. Marginal spot for hero - all options were acceptable IMO. Bet or check, call or fold after the raise.