Make thyme-flavored simple syrup: Microwave 1/4 cup water, sugar, and 8 thyme sprigs, stirring occasionally, until sugar is dissolved; chill at least 2 hours, then discard thyme.
Put a handful of ice in a cocktail shaker and add mezcal, lemon juice, liqueur, and 1 tbsp. thyme-flavored simple syrup. Shake and strain into a martini glass or a coupe. Garnish with a lemon twist and a thyme sprig.