At the end of Mea Culpa, I would also like to believe after the talk with Ecklie, that Gil made a point to take Sofia aside and thank her for all her hard work and for being honest and upfront with Ecklie. Surely Gil had to feel slightly responsible for her demotion even though the situation was out of both of their hands.
Course the very next episode they are in together, we see her being quite the spitfire she is again. Walking around the crime scene running her mouth a hundred miles an hour while Gil states to Brass, "She talks to herself." Brass comes back, "Hey it works for me." You can tell Gil is loving every minute of watching her work. There is no doubt Brass is in on helping keep Sofia around for his buddy.