Preheat oven to 400°F. Melt butter in an 8″ cast-iron skillet over medium-high heat. Pour all but 2 tablespoons butter into a small bowl; set aside. Add onion to butter in skillet; season with salt and pepper, and cook, stirring occasionally, until onion is softened and beginning to brown, about 4 minutes. Add apples, 2 tablespoons sugar, and 2 teaspoons thyme and cook, stirring often, until apples are softened, about 4 minutes. Transfer onion mixture to a medium bowl and reserve skillet. Whisk cornmeal, flour, baking powder, 1 teaspoon salt, and remaining 3 tablespoonss sugar in a large bowl. Gradually whisk in eggs, buttermilk, and 3/4 cup reserved melted butter until smooth (no lumps should remain). Fold in half of onion mixture and scrape batter into reserved skillet. Top with remaining onion mixture and remaining 1 teaspoon thyme. Bake cornbread until golden brown and a tester inserted into the center comes out clean, 3040 minutes. Let cool slightly before serving. DO AHEAD: Cornbread can be made 6 hours ahead. Reheat before serving, if desired.