You can make it a little simpler on yourself by using POINT OBJECT() and collecting the angles. Check out my last entry in the DarkBASIC Challenge thread. The red guy follows the blue using these steps:
1. record reds original angles
2. point red towards blue
3. record reds new angles
4. return red to it's original heading using the old angels
5. use CURVEANGLE() to smoothly interpolate the original angles to the new angles while moving forward.
The order of rotation is important so you may have to experiment a little bit and possibly use SET OBJECT ROTATION ZYX. See if this helps before diving into more meaty trig.
Enjoy your day.