Preheat oven to 425°. Grate 2 tsp.zest from lemon; reserve lemon. Combine zest, softened butter, garlic, and 1/2 tsp. each salt and pepper. Discard neck and giblets from chicken. Rinse chicken; pat dry. Loosen and lift skin from breast. (Do not totally detach.) Spread half of butter mixture under skin; place thyme under skin. Replace skin.
Cut reserved lemon in half; squeeze juice into cavity. Place lemon in cavity. Tie legs together with kitchen string; tuck wingtips under. Rub remaining butter mixture over chicken; sprinkle with remaining 1/2 tsp. each salt and pepper. Place, breast side up, on a greased rack in a greased roasting pan.
Bake chicken at 425° for 30 minutes. Meanwhile, peel sweet potato and apples. Cut sweet potato into 1/4-inch-thick half moons and apples into 1/4-inch-thick wedges. Arrange half of sweet potatoes in a 9-inch gratin dish. Sprinkle with 1 Tbsp. brown sugar. Arrange apples in a single layer over sweet potatoes; sprinkle with 1 Tbsp. brown sugar. Top with remaining sweet potatoes; sprinkle with remaining 2 Tbsp. brown sugar. Drizzle with 1/4 cup melted butter. Add salt and pepper to taste. Cover with foil.
Reduce oven temperature to 350°. Bake chicken 15 minutes. Add potato mixture to oven. Bake chicken and potato mixture at the same time 35 minutes. Uncover potato mixture, and bake chicken and potato mixture 40 minutes or until a meat thermometer inserted into chicken thigh registers 180° and potatoes and apples are tender.
Transfer chicken to a platter; cover with foil, and let stand 10 minutes. Serve with potato mixture.