Preheat your oven to 350°F (175°C). Generously grease a 9×13-inch baking pan and line with parchment paper, leaving an overhang on two sides for easy removal.
In a medium bowl, whisk together the flour, baking powder, baking soda, cinnamon, nutmeg, allspice, and salt.
In a large bowl, use an electric mixer to beat the butter and granulated sugar until light and fluffy, about 3-4 minutes.
Add the eggs one at a time, beating well after each addition. Stir in the vanilla extract. Scrape down the sides of the bowl frequently to ensure even mixing.
Gradually add the dry ingredients to the wet ingredients, alternating with the sour cream, beginning and ending with the dry ingredients. Mix until just combined.
Gently fold in the diced apples using a spatula.
Pour the batter into the prepared pan and spread evenly. Bake for 35-40 minutes, or until a toothpick inserted in the center comes out clean or with a few moist crumbs.
While the cake cools for about 15 minutes, prepare the caramel. In a medium saucepan, melt the butter over medium heat. Add the brown sugar and stir continuously until dissolved, about 2 minutes.
Bring to a gentle boil for 2 minutes without stirring. Remove from heat and carefully stir in the heavy cream, vanilla extract, and salt. The mixture will bubble vigorously.
Poke holes all over the warm cake using a skewer or fork. Pour about ¾ of the warm caramel sauce over the cake, allowing it to seep into the holes.
Sprinkle with flaky sea salt while the caramel is still warm. Let the cake cool completely before cutting into squares.