Is it a good idea to do research in high school?

I have an opportunity to do research at a university, but I won't be able to take morning classes at my high school.

This means throughout high school I will have only 5 AP classes and a lower weighted GPA.

Is this trade off worth it?

Provided you're still on track to fulfill all of your high school course requirements and this research is in a field that you plan to pursue in college, you should go for it. Not many students come to college with real research experience in a university environment. Even if your weighted GPA ends up a bit lower than that of some other applicants, you'll stand out.

Plan to produce a final project or paper that exemplifies your hard work. I assume you're doing research under the guidance of a professor, so you may even be able to have yourself listed as one of the authors of a published paper. Speak with your mentor to find out more about what the end product will be and how you might present this experience to colleges in the best way.