The Mad Hatter becomes available for purchase once you complete the first mission of the third hero episode.
Two things to note: completing the mission unlocks him for the shop, it does not add him to your roster automatically, so you still need to spend the studs. And he is tied to that specific episode's opening mission — finishing other episodes first will not trigger it.