Bring a medium pot of water to a boil over high heat, then plunge the lemons into the water for about 30 seconds or so, to soften any wax on the fruit. Drain, rinse, wipe the lemons clean, and dry them. Cut the lemons into very thin slices, discarding the ends and any seeds.
Combine the shallot, garlic, rosemary, thyme, and peppercorns in a small bowl. Combine the salt and sugar in a separate small bowl.
Arrange a layer of lemon slices in the bottom of a medium container with a lid, being sure not to overlap the slices. Sprinkle the lemons first with a little of the shallot-garlic mixture, then with some of the salt-sugar mixture. Repeat to use all the slices, layering them in several stacks and sprinkling them alternately with the two mixtures until the final lemon slices are topped with the last of the shallot-garlic and salt-sugar mixtures. Cover tightly and refrigerate for 3 days, but after a day or so, turn over the container so all the slices can cure evenly.
Drain the lemons in a strainer for about 15 minutes. Have ready a clean 1-quart container with a tight-fitting lid.
Pack the drained lemons tightly in the container, then fill with the oil, making sure the lemons are completely covered. The confit can be used immediately or refrigerated for up to 1 month.