To make caramelized pearl onions, remove the skins and cook peeled onions in a skillet with sugar, margarine, salt, pepper and water. Soak the onions in a bowl and cover with hot water for about five minutes to soften the skins. Remove the skins but leave part of the roots.
Combine all of the ingredients in a nonstick skillet, cover with a lid and cook over medium-high heat for 10 to 15 minutes. When most of the liquid is evaporated and the onions are tender, remove the skillet lid. Stir frequently and cook until the onions turn dark brown. Browning may take up to 10 minutes. Spoon into the serving dish and garnish with thyme sprigs, if desired.