In a large high-sided skillet, melt the butter over medium heat.
Add the onions with the thyme and 2 heavy pinches of salt and cook, stirring often, until caramelized, 40 to 45 minutes.
Discard the thyme.
Add the corn kernels and any juices scraped from the cobs with the garlic and a heavy pinch of salt and crushed red pepper.
Cook, stirring often until the corn is cooked and lightly caramelized, about 10 minutes.
Transfer to a bowl and let cool.
To the cooled onions and corn, stir in the sour cream, chives, and lime zest.
Taste and adjust the seasoning with salt, then serve.
