Preheat oven to 350° F. Grease a 9 x 13-inch casserole dish with 1 tablespoon of butter.
Finely chop the onion so that it measures ¾ of a cup.
In a medium-sized skillet or frying pan, melt the remaining butter over medium heat until it begins to bubble.
Add onions and cook until soft and translucent (about 3-4 minutes).
Stir in salt and cayenne pepper and remove from heat to let cool.
In a large bowl, add the cream cheese, corn, egg, and sour cream.
Add in the cooled onion mixture.
Carefully fold in the Jiffy corn muffin mix and sugar and mix until just combined.
Transfer the corn mixture to the greased casserole dish and bake covered for 30 minutes.
Remove the tinfoil and bake for an additional 5 minutes (or until golden brown in color).
Remove from oven and let sit for 5 minutes before serving.
Notes
To store, let the casserole cool to room temperature, then cover the baking dish with plastic wrap or transfer leftovers to an airtight container. It will keep in the fridge for up to 3 days.