Fixing gimbal lock, mouse position based rotations

Hello everyone,
I have a flying ship that rotates around the 3 axis based on the position of the mouse on the screen. Everything works great until the pitch is 90/-90 where I am assuming I hit gimbal lock and the ship and camera start shaking really badly preventing me to invert the ship. I have a general understanding of what gimbal lock is and I know quaternions are not immediately accessible in blueprints. I found a few solutions in C++ and a library for quaternions on the marketplace but I am struggling to apply these solutions specifically to my case. I was wondering if anyone could point me in the right direction and help me out. I apologies if I just miss something obvious, still pretty new to programming in UE4
Thank you.