Wow that sounds really dangerous for the computer LOL. I would never do that to mine, not unless I wanted to "accidentally" destroy it and have a replacement. But I do the same trick with my Xbox when the disc tray won't open. I would hit the top of the tray and it would come out.
LOL, it's not that dangerous considering it's a desktop. If you open the desktop you can look inside and see that the different parts start to pile up dust and might malfunction, so it's pretty much like cleaning the dust to the parts.