Assume a Divine Soul Sorcerer. The spellcasting feature of the class states (highlight mine):
Additionally, when you gain a level in this class, you can choose one of the sorcerer spells you know and replace it with another spell from the sorcerer spell list, which also must be of a level for which you have spell slots.
Can I do this when I gain level 1 in the class?
Let's say I choose the affinity good, which gives me the cleric spell "Cure Wounds" because of the Divine Magic feature:
Your link to the divine allows you to learn spells from the cleric class. When your Spellcasting feature lets you learn or replace a sorcerer cantrip or a sorcerer spell of 1st level or higher, you can choose the new spell from the cleric spell list or the sorcerer spell list. You must otherwise obey all the restrictions for selecting the spell, and it becomes a sorcerer spell for you.
In addition, choose an affinity for the source of your divine power: good, evil, law, chaos, or neutrality. You learn an additional spell based on that affinity, as shown below. It is a sorcerer spell for you, but it doesn't count against your number of sorcerer spells known. If you later replace this spell, you must replace it with a spell from the cleric spell list.
If my class allows me to replace a spell when I gain Level 1, then the Divine Magic would allow me to replace the "Cure Wounds" with for example "Guiding Bolt".
Now intuitively I would say no, because Level 1 is the first level and you can't have less, so you don't "gain" it. However some features explicitly state "Starting at 1st level", for example the feature "Favored by the Gods" from the same Divine Soul Sorcerer. This does hint to me that there might be a "gaining" of 1st level, otherwise this extra wouldn't be necessary.
Starting at 1st level, divine power guards your destiny. If you fail a saving throw or miss with an attack roll, you can roll 2d4 and add it to the total, possibly changing the outcome. Once you use this feature, you can't use it again until you finish a short or long rest.
Bonus question: Is it any different if I multiclass into sorcerer and my first Divine Soul Sorcerer level is not my first character level?