This is actually a very common misconception about the scientific method that we seem to teach in schools. The scientific method is not just about identifying the "right" laws governing the universe. It is also about building useful models of the universe. In fact, if you are willing to sit down with any real scientist, and use the right philosophical buzz words, you can even get them to admit that they can never provably achieve the former. So let's start to play with some of those philosophical terms!
Philosophers call the study of reality "ontology." The word "reality" gets treated many different ways, but intuitively, ontology is looking for what is actually real, not just what appears to be real. Epistemology, on the other hand, is the study of knowledge. Empiricism, a word you may have heard with reference to science, is a branch of epistemology. It studies what we can know through observation of the world around us.
The line between these can be seen several ways, but I find the most impressive of them to be the brain-in-a-vat thought experiment. Consider the possibility that you are actually just a brain, sitting in a vat somewhere, being fed neural stimulus like you were part of the Matrix. Ontology would be very interested in the "real world" where you are a brain in a vat, and would call the neural stimulus you are receiving a "simulation." However, just as we saw in the The Matrix, it is remarkably hard to make definitive statements about this reality while you're still jacked into the matrix, and have never observed the outside world. This is the epistomological side: how can one know the state of reality? An empirical approach would focus entirely on what can be observed, the stimulus. A 100% empirical scientist would actually not really care whether they are a brain in a vat or not until they identify an observation to defend it (although, in reality, no human is ever 100% anything!)
How do we get confused? There are three major categories of thought in logical philosophy. You're almost certainly familiar with deduction and induction. Deduction is going from the general to the specific (all swans are white, so this swan must be white too). Induction is going from the specific to the general (these swans are white, so perhaps all swans are white). There is a third you hear very little about: abduction. Abduction is the ability to infer the best explanation is true. In many discourses, such as science, you end up with many explanations. Maybe your empirical results line up with your theory because your theory is ontologically right, or maybe someone is cleverly massaging the world behind the scenes to fool you. At some point, you may decide the best explanation is that you've found something useful, so you infer your theory to be correct. This mode of logic is a fascinating little puzzle because the term "best explanation" leaves so much room for alternatives (read the SEP link above if you're interested). However, any claim of an empirical method, such as science, yielding an ontological truth must go through this abductive step.
So where does that leave us for the scientific method in the presence of your Mad God Shegorath? Well, from an abductive perspective, the alternative explanations of "Shegorath is just fooling us" starts to become a better explaination, so it becomes harder to use abduction to claim you have arrived at the only worthwhile best possible explanation. You would see additional questioning of scientific results.
Enter the Engineer.
Engineering and science are tied together intimately, like husband and wife, or perhaps even like conjoined twins. While science provides epistemological ways to "know" things, engineering uses that knowledge to build up the world around us. Of course, science never feeds us perfect knowledge. Only recently did we find out that all of our equations of motions we've been using for a long time get gummed up by relativity. Only recently did we find out that much of the world is non-deterministic thanks to quantum mechanics. Yet what we created from that era is still useful. How?
Engineers have a phrase, which I commit to my heart: "All models are wrong, some are useful." We can assume that every model we come up with can be ontologically wrong, because the track record of scientific "knowledge" being revised as new data comes along is 100%. That's not a shortcoming of science, that's actually its strong point: it always tries to incorporate the new observations, no matter how undesirable they might be. However, it turns out that for almost everything you or I could want to do, it doesn't have to be perfect. It just has to be close enough to be worth doing.
Take teflon, PTFE. Science can develop the molecular structure of PTFE, and say "this is how PTFE works." However, never once will we create a magical perfect PTFE molecule. Every process to make it is slightly flawed. The engineering side is worried about how to use what the science knew about PTFE to coat a non-stick pot. If the science is a little wrong, that's okay. We'll do a test run first, to make sure the pots are useful, before selling them! The science is just treated as a guideline -- what really matters is whether the process works or not, not whether it matches exactly the predictions of science. If the science turns out to not be useful for engineering, it will just sit on the shelf until it becomes useful, or dispelled.
This is, for example, how we managed to make electronics work for hundreds of years, despite getting the flow of current backwards the entire time. Ben Franklin had to make a guess as to which way the charge was flowing. He guessed wrong, so technically everything we've done with electronics is incorrect. However, his model of electricity was useful enough that there was no need to correct it, until the semiconductor era, where paying attention to what is an electron vs a hole can actually matter.
So the scientific method would still be viable in this world with a Mad God. It would simply gravitate towards applications where behaviors are still relatively predictable, even after the Mad God. Consider the fact that you're looking at a computer screen right now. If the Mad God were to make the laws of physics too unpredictable, photons would not go in straight lines, and you couldn't read.
Of course, it's possible the Mad God decides to only screw with science. He might decide that every science experiment is going to go awry. In this case, he creates all sorts of interesting looping structures as we try to define what a scientific experiment "is." He may actually disappear in a poof of logic, akin to Douglas Adam's god in Hitchiker's Guide to the Galaxy! Or he might form a strange loop a. la. Douglas Hofstadter, where he controls the universe, and the universe decides what he will do.
If you're going down this path, you're going to have to describe what "viable" means in the question "is the scientific method viable...." If you are presuming an ontological world with such a crazy powerful entity, you are going to have to define your term "viable" in a way which makes sense in their presence. There may also be the question of whether the viability, once defined, can be known by a mere mortal. These questions oft leave philosophers awake at night.
As a final fun tidbit, what's to say he hasn't already acted? The ultimate observation, in philosophy, is one done by a being that can think. The ability to do this is called perception. As silly as it may sound, philosophers do not have a clear sense of what perception is, nor how it behaves. Maybe we are just a brain in the jar. Could we perceive it?