Melt butter in a large skillet over medium heat. Add the onion and green onion and saute until the onions soften. Add the corn, salt ,thyme, cayenne and black pepper, and cook until the corn is tender and warmed through, about 3 to 5 minute.
In a large mixing bowl, beat the eggs with the cream until blended. Stir in 1 cup of the grated cheese and the corn mixture. Pour the mixture into a greased 8x11 baking pan(or close to). Top with the remaining grated cheese and bake for about 25 to 30 minute The gratin is done when a knife inserted in the center comes out clean. Top with the chopped parsley and serve warm.