Preheat oven to 350บ.
Melt butter with 1 1/2 T. of oil in skillet over medium heat. Add corn and saute 5-6 minutes and remove from pan.
Return pan to medium heat and add remaining 3 T. of oil. When oil is hot, add potatoes and onions, saute until tender 7-8 minutes.
Remove pan from heat. Stir in corn, rosemary, salt and cayenne.
In large bowl, whisk eggs and half n half. Add corn and potato mixture plus 1 1/2 cups of cheese.
Transfer to baking dish and bake 25 minutes or until gratin begins to set.
Remove pan and sprinkle with remaining cheese and continue baking for another 15-20 minutes or until a knife comes out clean.
Cool for 5 minutes.