After the JK story is done on Belsavis you're asked to go to a station Korriban's Flame, there you will defeat Leeha and her droids. If you're lvl 50 the droids don't agro on you automatically (did not try this before lvl 50 so not sure about 40s), but once you defeat Leeha you can talk to her again for companion conversation. You'll have to repeat the coversation many many times to get the affection you want but it's doable. My hands got tired and after completing the mission I got 2k+ affection with Doc. I should have done this with the other companions as well, since this is non-repeatable after the completion of the quest.
So don't kill the droids and just keep on talking to Leeha for the amount of affection you want. Might also want to keep track so you know how many times you've had the conversation so you don't go past 10k affection. Your hands will be sore but saves a lot of gifts.