Gimble Lock and "Track To"

A card game I am working on places cards on a table and orients each card “slot” to a positioning marker using the “Track to” Edit Object Actuator. However some cards need to be angled at 45 degrees (positive or negative). Since the face of the card displayed to the camera matters, and the “Track to” actuator always displays the “Up” side of the card while orienting. I wrote 2 functions to disable the actuator and manually rotate the cards.

            if Global["Side"] == "Opponent":
                if Own in l:
                    if l[0] == "EHAND":
                        if (2.356 - ori.x) > .04:
                            ori.x += -.04
                        if (2.356 - ori.x) < -.04:
                            ori.x += -.04
                        if (2.356 - ori.x) < .04 and (2.356 - ori.x) > -.04:
                            if (-1.2795 - ori.y) > .04:
                                ori.y += -.04
                            if (-1.2795 - ori.y) < -.04:
                                ori.y += -.04

                        ori.z = 1.2795
                        own.orientation = ori

On the whole this code works fine for one player, but the opponent’s cards (above) get gimble locked and spin infinitely no matter how I re-structure the code.

TLDR I am looking for either a way to choose which face of a object tracks with the “Track to” actuator, or a way to prevent gimble lock when manually rotating cards to X 2.356, y -1.2795, z 1.2795.