How to apply Custom Transform Orientation as a Local Transform
As I discovered while working on Blender function to transform a selected edge along a custom axis the transforms are stored in bpy.context.scene.orientations[i].matrix.  You can use orientations[0] or orientations[name].

If you want the rotation component as a quaternion use orientations[i].matrix.to_quaternion() .