Oh right, I think I see your confusion.
The "keyhole object" oKeyhole is just the thing you click on to make the character look through the keyhole? In that case, it's completely irrelevant to the problem. The only thing that matters is the graphic you actually want to display, and you should make sure you don't confuse "the overlay where we display the graphic that shows the view through the keyhole into another room" (let's call it keyholeView) with "the object that represents the keyhole for purposes of interacting with it in the room" (oKeyhole).
So this line is wrong:
Overlay oKeyhole = Overlay.CreateGraphical(20, 20, oKeyhole_40, true);
What you're actually doing here is to define a new overlay (a graphic displayed on the screen) that has the same name as the object oKeyhole that already exists. You should never try to define two different things with the same name that exist at the same time: either it won't compile and run, or it will lead to bad bugs. Also, oKeyhole_40 isn't a thing, you can't use that as an argument. You need to just take the number of the sprite you want to display, in this case 40.
So what you should do instead is something like:
Overlay* keyholeView = Overlay.CreateGraphical(20,20, 40, true);
Wait(GetGameSpeed() * 3); // 3 seconds
keyholeView.Remove(); // Note the same name!
Notice also the * after Overlay in the first line. That's important (it means that keyholeView is a pointer: you don't have to understand what that means, just remember that you have to use it for some things). Some people, like Khris, put the space before the *. It works either way, but IMO it makes much more sense to have the * as part of the type rather than the variable name.
Now, to make this run is where oKeyhole comes in. You probably want to add it as an OnClick (or OnInteract or whatever) handler for that object. So go into the oKeyhole events (in the room editor), and select the event you want. It should generate a new function for you that is called something like oKeyhole_OnClick(). Put the code inside that function.