Make the filling: Put the pork in a deep saucepan and cover with cold water (about 6 cups). Add 2 teaspoons salt, the onion, thyme, oregano, bay leaves and peppercorns; cover and bring to a simmer over medium-high heat. Reduce the heat to maintain a gentle simmer and cook until the pork is tender, 1 hour, 30 minutes to 2 hours. Transfer the pork to a plate and shred. Strain and reserve the cooking liquid; keep warm.
Meanwhile, soak the corn husks in a bowl of hot water, using a plate to keep them submerged, until pliable, 1 hour.
Combine the pork, cumin, 1/3 cup chili powder, the garlic, flour, sugar, vegetable oil and 1 cup of the reserved cooking liquid in a large skillet. Bring to a simmer over medium heat; cook, stirring occasionally, until most of the liquid is absorbed, about 25 minutes.
Meanwhile, make the dough: Mix the masa harina, lard, 2 teaspoons salt, the remaining 1/2 teaspoon chili powder and 2 2/3 cups of the reserved cooking liquid in a bowl until combined.
Drain the husks and pat dry. Starting 1/2 inch from the wide end, spread about 3 tablespoons of the dough down a husk, leaving a 1-inch border on the sides. Spoon 2 tablespoons of the pork filling down the center of the dough, then fold in the sides of the husk, wrapping the dough around the filling. Fold up the narrow end of the husk. Repeat with the remaining husks, dough and filling.
Set a steamer basket in a large pot filled with 1 to 2 inches of water. Arrange the tamales standing up in the steamer, folded-side down. Bring the water to a boil over medium-high heat, cover and steam until the dough is firm, 45 to 50 minutes. Remove from the steamer and let cool slightly before unwrapping.