You didn't say what year your car is, but it may be the temperature sensor is blocked or the temperature fan is failing. There is a tiny fan that blows air across the sensor which is very quiet. The vent is below the center armrest for the older Model S (2014 to 2021). You should see a bunch of holes in a circular pattern where the air is brought in. On the 2021+ LR/Plaid, this is moved to just above the front of the phone chargers. In either case, the fan pulls air across the sensor. If the vent is blocked, or you have something hot/cold right in front of it, it will screw up the cabin temperature. Of course, if the fan isn't working that will screw up the temperature too. I don't think the 2012 to 2013 Model S has the fan, but I'm not exactly sure when the fan was added. These oldest cars do not have holes below the center armrest and I'm not sure where the sensor is located.
My 2022 S and prior 2016 S held the cabin temperature fairly well.