Peel and cut the eggplant into ½ - inch dice. Sprinkle lightly with salt and drain in a colander for 1 hours to remove excess water and bitterness. Pat the eggplant dry with paper towels.
Heat 3 tablespoons of the oil in a large frying pan (preferably nonstick) over high heat until hot. Add the eggplant and sauté until lightly colored. Season with pepper; reduce heat and cook, stirring frequently, 10 to15 minutes longer. Remove from the pan and drain excess oil: set aside.
Heat the remaining 2 tablespoons oil in the pan over low heat. Add the chopped garlic and cook until soft but not colored. Add the tomatoes and the thyme. Season with salt and pepper and cook 20 minutes.
Preheat oven to 375°. Layer half the eggplant in the bottom of a baking dish. Cover with the tomatoes mixture. Top the remaining eggplant and sprinkle with the cheese.
Bake for 15 minutes, and then reduce the oven temperature to 325° and bake until the gratin is bubbling and the cheese is golden brown, 20 to 30 minutes. Serve in the baking dish.