Process onion, scallions, chiles, garlic, allspice, peppercorns, five-spice powder, nutmeg, dried thyme, and salt in a food processor until a coarse paste forms, about 15 seconds. With processor running, gradually pour soy sauce and oil through food chute, and process until combined, about 10 seconds. Transfer marinade to a large nonreactive bowl.
Add chicken pieces to marinade, and toss until well coated. Cover and refrigerate for at least 4 hours.
Preheat grill to medium (350°F to 400°F). Let chicken stand at room temperature while grill preheats. Remove chicken from marinade, letting excess drip off. Coat top grate with oil; place chicken, skin side down, on grate. Grill, covered, turning chicken occasionally, until well browned and an instant-read thermometer inserted into thickest portion of chicken breast registers 160°F and thigh registers 170°F, 35 to 40 minutes.
Transfer chicken to a platter, and let rest 10 minutes. (Internal temperature of breasts will continue to rise to 165°F.) Garnish chicken with thyme sprigs, and serve with lime wedges.
