To prepare turkey: Position rack in lower third of oven; preheat to 400°F.
Rub off excess papery skin from garlic heads without separating the cloves. Slice the tips off, exposing the ends of the cloves. Place the heads on a square of foil. Sprinkle with 4 teaspoons water and wrap into a package. Roast until very soft, 40 to 45 minutes. Unwrap and let cool.
Zest lemons. Place the zest in a medium bowl; juice the lemons into the bowl through a strainer to catch the seeds. Reserve the squeezed lemon skins.
Add miso, oil, chopped thyme and pepper to the lemon mixture. Squeeze the garlic cloves out of their skins into the bowl. Whisk until the mixture forms a paste.
Reduce oven temperature to 350 degrees. Set aside giblets and neck for making Turkey Giblet Stock, if desired. Pat the turkey dry with paper towels.
Loosen the skin over the breast and thigh meat. Rub the paste under the skin onto the breast meat and leg meat and a little inside the cavity. Tuck the wing tips under the turkey. Place the reserved squeezed lemon skins, thyme sprigs and 2 onion quarters in the cavity. (You may not use all the citrus skins.) Tie the legs together with kitchen string. Place the turkey breast-side up on a roasting rack set in a large roasting pan.
Roast the turkey for 1 hour. Add 2 cups water and the remaining onion to the pan, tent with foil and continue roasting for 1 hour more. Baste the turkey with pan drippings and continue roasting, basting every 15 minutes or so, until an instant-read thermometer inserted into the thickest part of a thigh without touching bone registers 165°F, 1½ to 2 hours more. Add more water 1 cup at a time if the pan is dry.