Poker is about making the right play.
So ask yourself not how much money would i have made but did i make the right play?
Preflop i can justify you calling with that hand (just about anyway with number of opps etc)
On the flop we can just about justify the call too (gutshot and two possible live over cards)
but you cannot in any way justify making the turn call with the draws you have and i would consider any pair i hit to be no good.
Therefore by folding here do you make the right play?
yes
Therefore forget you hit the river for bad odds, you made the right play and if you continue to make 'the right play' in relation to drawing to hands you will money more often than not.
So dont let this hand bother you at all.