Of course, fresh corn is best, but frozen will do.
In a large skillet over medium heat, melt the butter. Add the corn, shallots, sugar, and salt and pepper. Cook, stirring occasionally to prevent burning, until the corn is caramelized, about 5 minutes.
Stir in the thyme and cook 5 minutes more. Season with salt and pepper.