From my experience the new LH IT system is crappy , and if you change the FFP number in lunge or at the gate, usually miles will be credited to the wrong program (other than indicated on new boarding pass).
This is not cheating the system - Star Alliance offers some privileges to their gold members, and there is no rule, that miles must be credited to FFP of the airline which issued gold card.
On some airports there are incompetent agents who do not provide gold privileges until the miles are credited to *G FFP, but usually talk with manager helps.