I am not surprised to hear that you found CPAP to change your brain function. First of all Obstructive Sleep Apnea (OSA) occurs during the maintenance time for the brain and tends to upset it. So if you fix OSA that alone will begin to change brain function and upset the equilibrium which has been found with your brain, life, and the antidepressant.
But during a stressful time in your life CPAP quickly did more harm that good. I have a possible explanation.
The anatomic factor that CPAP is designed to fix is the critical closing pressure of the airway. The idea is that it simply does not let the air inside the airway reach that pressure. But there are nonanatomic factors which also contribute to sleep apnea[1,2]. Lets look at two of them:
High respiratory control loop gain. To illustrate how a control loop works consider getting the water temperature comfortable in the process of taking a shower. To make this happen I hold my hand under the tap and adjust the lever in the direction of hot or cold depending upon what my hand felt for temperature. Now if the hot water were say 50 degrees hotter than normal imagine how it would be hard for me to find the comfort point. First too hot, then only a little change results in too cold, then too hot again. With the “gain” higher it is harder to find a stable point. So it is with breathing when the gain is too high. The times of high breathing can result in arousals. The times when breathing is too little can be hypopneas or apneas. Technically they are hypocapnic central apneas or hypopneas.
So looking back at what you described it may have been that the PLUS respiratory control loop gain factors of CPAP PRESSURE + LIFE STRESS = unstable breathing with arousals and circulation and metabolism changes especially in the brain.. This may have also resulted in long term facilitated hyperventilation. I have seen life stress result in hyperventilation during the daytime. There is no doubt in my mind that life stress is a major player in respiratory gain night and day.
Then there is the arousal threshold. Often arousals in sleep apnea are known as respiratory effort related arousals. In the case of an obstructive apnea it is true that the respiratory effort, vain as it may be, leads to the arousal. But if the threshold is low enough a minor change in breathing effort can trigger arousal.
I think that both arousal threshold and loop gain could be related to a too low or too high vitamin D3 level. Where I live we get no UVB from the Sun from about August to April. Vitamin D levels drop all that time.
Those who are working with the D3 hormone (A.K.A. Vitamin D3) (e.g. Dr. Stasha Gominak, Michael F. Holick, Ph.D., M.D., Vitamin D Council) seem to be finding that the very low side of the “normal” range of 30-100 ng/L produces a range of symptoms including OSA, pain, and infection. All believe that a level lower than 50 ng/mL is not good and Dr. Stasha Gominak recommends 60-80 ng/mL for good health.
It would probably be wise to check your vitamin D3 levels. See “The Vitamin D Council” for assay details.
For arousal threshold the best thing for me is a good long walk during the day. I walk regularly so enstead of my average 8,000 or so steps I would walk say 14,000 steps. It is enough for me to notice feeling tired at the end of the day, makes it easier for me to fall asleep, and since much of it is up hill in my little city I believe the respiratory control system also gets a good workout and so breathing seems to be more stable as well.
I believe that all with OSA should be assigned a dietitian and personal trainer for three years.
But it may well be that your arousal threshold and respiratory control system gain issues cannot be controlled with good effort to control life stress, vitamin D3 levels, moving well and eating well. It this occurs I would recommend that you talk with your doctor about using EERS or even possibly dynamic CO2 therapy. I mention to a member here that I thought they were headed toward using a new generation ASV PAP to deal with the ventilatory instability I believed they were dealing with. Thier response was that they believed they could not possibly deal with the constant pressure changes from an ASV. EERS is passive and I have used this myself to help smooth out the breathing issues during times of high stress in my life. What can I say. It works for me.
 Danny J. Eckert, David P. White, Amy S. Jordan, Atul Malhotra, and Andrew Wellman "Defining Phenotypic Causes of Obstructive Sleep Apnea. Identification of Novel Therapeutic Targets", American Journal of Respiratory and Critical Care Medicine, Vol. 188, No. 8 (2013), pp. 996-1004. doi: 10.1164/rccm.201303-0448OC
 Sairam Parthasarathy M.D., Emergence of Obstructive Sleep Apnea Phenotyping. From Weak to Strong! American Journal of Respitory and Critical Care Medicine VOL 188 2013
-- critical closing pressure [Pcrit] - Arousal Threshold - ventilatory control Loop gain - and genioglossal Muscle responsiveness. Pcrit, Loop, Arousal, Muscle (PALM)--
: Gilmartin G, McGeehan B, Vigneault K, Daly RW, Manento M, Weiss JW, Thomas RJ.
Treatment of positive airway pressure treatment-associated respiratory instability with enhanced expiratory rebreathing space (EERS).
Source: J Clin Sleep Med. 2010 Dec 15;6(6):529-38. Division of Pulmonary, Critical Care and Sleep Medicine, Beth Israel Deaconess Medical Center, Boston, MA, USA.
: Dynamic CO2 therapy in periodic breathing: a modeling study to determine optimal timing and dosage regimes
Yoseph Mebrate, Keith Willson, Charlotte H. Manisty, Resham Baruah, Jamil Mayet, Alun D. Hughes, Kim H. Parker and Darrel P. Francis
J Appl Physiol 107:696-706, 2009. First published 23 July 2009; doi: 10.1152/japplphysiol.90308.2008