Make cake: Preheat oven to 350°F. Lightly grease 2 (8- or 9-inch) round cake pans; line with parchment, grease again and dust with flour.
Beat butter and sugar with an electric mixer until fluffy. Add eggs one at a time, beating well after each addition. Beat in sour cream, then cocoa, baking soda, allspice, cinnamon, ginger and salt. Reduce speed to low; beat in apples and flour until blended. Stir in raisins and pecans (batter will be thick).
Spoon batter into pans, smoothing top. Bake until a toothpick inserted in center comes out clean, about 45 minutes. Cool on a wire rack for 10 minutes, turn out onto racks; remove wax paper; cool. Refrigerate until ready to use. (Cakes can be made a day ahead, wrapped tightly in plastic and refrigerated, or up to 3 weeks ahead and frozen.)
Make brown-sugar frosting: Melt butter over medium heat; stir in brown sugar and cook over low heat, stirring, until sugar and butter are blended, about 5 minutes.
Stir in milk and cook over medium heat just until mixture comes to a boil, stirring often. Let cool, about 1 hour.
Add confectioners' sugar, about 1/2 cup at a time, whisking until smooth and spreadable. Whisk in vanilla. Add food coloring in small increments until icing is desired shade of pumpkin. Use immediately.
Assemble cake: Spread about 3/4 cup frosting evenly on top of a layer. Place second layer on first and frost top and sides with remaining frosting.
Using black icing, pipe on a spiderweb (see photo). Make spiders with M&M's, adding eyes and legs with icing. (Cake can be loosely covered and kept at room temperature for up to 2 days or refrigerated for up to 5 days. Bring to room temperature before serving.)