What others have said OP, i'd like to know more. I suspect that what you mean by 'gifted' is that he seems (in terms of milestones) advanced in one or more areas. While i wouldn't go as far as to say that my DS (also nearly 3) is gifted, he is certainly very bright, articulate and occasionally finds situations difficult which result in huge meltdowns for no apparent reason - he is simply overwhelmed by emotion. I am not sure whether he finds some situations difficult because he is frustrated due to being advanced and not provided with enough stimulation or because he's a perfectly normal toddler who is growing up and finding the process of learning and interacting quite hard work. I don't really care about the reason because the job i have to do is the same.
It helps to rule out the basics: is he acting out through hunger, tiredness, discomfort, illness or being outside of his comfort zone/ routine/ environment? If not, then it makes sense to question whether he might be doing it to test boundaries, as all toddlers do in order to learn, or whether it's frustration that might instead be linked to his capabilities.
It's all guess work i'm afraid. We've had some success with DS's frustration by explaining calmly to him why and how things do or don't work or can and can't happen, and guiding him on how to achieve what he's trying to do. Also giving him plenty of opportunities to do activities that allow him to test out his strengths (with DS it's verbal, physical and reasoning skills that are particularly strong). Is your DS getting these opportunities to really stretch himself at school, or might he be bored?
What's he like in social situations? How does he interact with others?