Sounds like a grounding problem. The brake lights are grounding through the headlight circuit and turning the lights on kills the ground. My guess though is it's not the headlights themselves that are killing the ground. I'll bet it happens if you just turn on the running lights but leave the headlights off.
First thing I would do is grab a long wire or a set of battery jumper cables. Temporarily connect a ground wire from the trailer to the tow vehicle and see if all the lights work.
Next pull the bulbs out of the taillight housing and inspect them. Do they both have a dual filament or did somebody force a single filament bulb into the socket? Inspect the sockets and housing and make sure they aren't melted and the contacts in the socket are free to move and spring back if you push them.
If there is a ground connection in either light housing then make sure it's tight. Try running a separate ground from the outside of the light socket to a ground on the trailer. See if the lights now work with the headlights on.
Do the running lights work correctly?