Question: Consider our world at 18-19 centuries. Our civilization knows how to print books, build steam machines, we have made first experiments on electricity. And one day the [Mad God Sheogorath](http://elderscrolls.wikia.com/wiki/Sheogorath) is emerged. He can bend the reality by his will. 

For example, he can violate the principles of conservation of energy - build Perpetuum Mobile just to irritate scientists. 

He can convert Darwin back into the monkey just to help him prove his theory. 

He can make forgery of dinosaur skeletons, so we have found caterpillar riding tankosaurus instead of diplodocus.

He can resurrect people.
And, do a lot of things we are not aware.

So, in potential he can spoil every scientific acquired experiments result in a way, that is hard to see. 

So, the question is: is scientific method still possible in this world?

UPD: after 20 years Sheogorath have just vanished. Can we undo his trickery and restore science methods?

Answer: 
**Absolutely**

To quote some mouseover text from a certain webcomic: 'We don't use science to prove we're right. We use science to *become* right'. The scientific method is just as valid in your crazy mixed up world as it is now, and will remain so unless the world becomes so crazy that no logical sense can be made of it *at all*. This is because science *isn't* something that we use to show a particular result, it's the way we can explore the world around us. 

If, suddenly, the rules don't seem to apply because a mad god is messing with us, then the scientific method can still be used to tell us whether or not there is something messing with us. Then it can be used to explore the limits of this entity, and even it's psychology. This then forms a new paradigm of the world, and new theories start to form around that, bolstered by the scientific explorations mankind is making into the nature of our environment *with the mad god in it*. 

The only way in which this doesn't work is if the mad god is randomly changing everything, all the time, to the point where everything that humanity could possibly know breaks down. At that point it's a somewhat moot point, because the universe will have become a tumultuous maelstrom summoned from the fever dreams of a crazed god.

As an example: The mad god has decided to break all experiments that require electrical measurements. Scientists notice that while all their lab equipment is broken, the lights are still on. A simple experiment therefore becomes: when I turn the light switch: do the lights turn on and off? My hypothesis is that the light switch controls the flow of electricity to the light. Now the mad god has a choice. Either the lights continue to work as normal (hooray, the scientific method worked!) or he chooses to change how lightswitches work. If he goes for completely random on-off for lights and light switches, either *the world now works in a different way*, namely, nobody can control the lights, or it's just our scientists that are affected. Either way we then know more about the world around us, either something powerful is messing about with rigorous scientific experiments, or that lights now turn on and off at random, and nothing can stop it.

TL:DR: The scientific method is used to figure out how the world works. If the way the world works is that we're captive to the whim of a god who doesn't like science, that's what we'll find out using it. From that point on it's one for the theopsychologists.
As a writer and reader, if I'm dealing with a being with what we might call "godlike powers", they still have to operate within a larger reality. For example in your setup, Sheogorath builds a tiny "Perpetual Motion Machine" but is actually cheating because in some mysterious god power way, it is perfectly converting a few molecules of MysteriousInvisibleSubstance to Energy at the nano-level. Maybe there's even enough MysteriousInvisibleSubstance to last a thousand years and it's really really hard to detect. MysteriousInvisibleSubstance can also alter visible reality so that Darwin is now stuck in what appears to be a monkey body. Sheogorath can also in some odd way travel in time and use his nifty MysteriousInvisibleSubstance powered MatterReasssembler to screw with the fossils just to screw with the human's of the future's heads. Then Sheogorath disappears. 

Until the sentients are clever enough to figure out how to detect and then use MysteriousInvisibleSubstance at the molecular level, no "laws of reality" in that fictional world disturbed. That said, for the WorldBuilding exercise to be any fun to read, etc. When the sentients or others of Sheogorath's species figure out what he's been up to and how, Sheogorath is going to be in BIG BIG trouble, right?