The three of a kind is in the community cards, so everyone has it. In that case it goes to whoever has the highest spare card, the ace in this case.