Melt butter in heavy skillet and saute onion in it until brown, about 10 minutes. Stir in corn. Set aside to cool. In a medium bowl, whisk buttermilk, egg, salt and pepper to blend. Combine remaining dry ingredients in a large bowl. Whisk in buttermilk mixture. Stir in onion and corn. Pour batter into buttered 9-inch pie plate. Bake at 350 degrees until brown and firm, about 50 minutes. Cut into wedges to serve.