It’s hard to get away from a hand that strong, but I think you could have done it.
3-bets and 4-bets are incredibly strong and it’s pretty rare that 1/2 players are 3- and 4-betting betting a draw here. Maybe KQ/QT/KT of hearts, but I still think they are flat calling here. Only reasonable hand that’s 3-betting here that you beat is A6.
Now when 2 people jam behind you, there is even less of a chance you have the best hand. It sucks to fold such a strong hand, but I’d say you’re behind here more than 95% of the time. Occasionally you’ll get two players blasting off with draws, but folding here is the right and profitable decision long run. I’d rather call here with KQhh before I call with AJ.