Heat the oil in a large pan and gently cook the onions until translucent. Add the garlic, fry for one minute then add the eggplant, peppers and courgettes.
Gently cook for 4 minutes then add the tomatoes, tomato puree and thyme. Season with salt and pepper and simmer for about 20 minutes, stirring occasionally.
Meanwhile, make the sauce. Put the oil, tomatoes and sugar into a blender and whizz until smooth. Push through a fine sieve into a small pan, heat gently and season with salt and pepper.
Slash the skin of the fish, rub with the lemon juice with oil and cook, skin side down, in a hot pan for 4 minutes. Turn and cook until the fish is cooked through.
Serve the fish on a bed of sauce and ratatouille.