In the EDI setup parameters for a partner (X12 Properties/Party as Interchange Receiver/X12 Interchange Envelope Definition/GS and ST Segment Definition), you can enter multiple lines to set up GS segments for different transactions for that partner. Normally, for an 867 the GS01 element should have the value “PT”, and the 852 should have the value “PD”. What actually happened is that if a particular line was set to be the “default”, the values on that line were being used for all transactions. And there is no way to avoid setting one of the lines as default.
The problem in this case went back to the EDI R2 tutorial. I blindly copied the parameters for my transactions from the outbound parameters that they had set up for the partner named "THEM". The target namespace was set to
http://schemas.microsoft.com/Edi/X12, whereas for my configuration it needed to be set to
http://schemas.microsoft.com/Edi/X12/2006. The ST1 value, version, and namespace are all used to identify the line that applies to the particular outbound transaction, and the rest of the parameters on that line are then used to build the GS segment. This is clearly specified later on in the documentation, on a page called "Configuring X12 Interchange Envelope Generation" under:
Development > Developing BizTalk Server EDI Solutions > Configuring a Party for an EDI Solution > Configuring X12-Specific Party Properties