You could have an intermittent bad connection (heat expansion related?), but could try the following to attempt a software fix for your problem:
1) Enter the BIOS (F2 at startup) and choose to "Load Optimized Defaults", then Save & Exit.
2) Reinstall the keyboard and touchpad drivers.
If you boot up to a Linux "LiveCD" distribution and the keyboard and touchpad fail to respond, it would indicate the problem is most likely hardware. Being able to type in the BIOS makes a Windows software cause more likely, however.
G74SX-A1 - stock hardware - BIOS 202 - 2nd Monitor VISIO VF551XVT