You need to make larger bets. You gave him 3/1 on flop and then 4/1 on turn. You then call the river when you know you are beat. Calling when you are beat is bad play no matter how frustrating it is.
Easy to say now, but i would have bet pot on the flop with two hearts on the board. Either that or check-raise the flop. He just calls, chances are he's chasing. Third heart hits, well you gotta consider the fact you're beat. But it's an Ace so prob worth a call or check if you can, to see river. Fourth heart hits, you gotta fold unless you have a heart. Frustrating when donkeys chase and hit but you gotta be disciplined and NOT pay them off.