I was going to suggest that maybe your husband coming home made her happy because she hadn't seen him all day, but then you updated.
I do have a good word of advice, though. The 2nd article soz posted describes what happened with me, when I was a child. For various reasons, I attached to my paternal grandmother far more than I did to my mother as baby, after mom went back to school. My grandma stayed home to raise my dad and aunts, and she would stay home to babysit me when my parents were working. I spent many nights there because I really liked my grandparents' house a LOT!

I even ended up learning Spanish before English (I started talking at around 11-12 months, *really* late! But I'm a quiet person today, so..

), which created a language barrier between my mom and me.
When I started to live at home more, I didn't like the new situation. I used to tell my grandma that I didn't love my mother, and I'd say that she (mom) wasn't my real mother. I understand this was very hurtful, but I was a toddler and didn't mean it. When my little sister came around, she became the apple of my mother's eye. She could do nothing wrong, but I was always criticized. Almost nothing was directed at me that wasn't spiteful. I clearly remember one day, I came home with a score of 104% on a test (I had gotten almost all the extra credit right but one) and my sister got an 83% on a test. My mother praised my sister's "great" score, but told me that I didn't do good enough. I got an A+ and my sister got a C! My sister would get prime care if she so much as had a a headache, but when I would be so ill that I'd pass out, I'd get yelled at over it.
I'm 23 and my sister is nearly 21, and this behavior hasn't changed. In fact, it's MORE obvious that my mother greatly favors my sister over me. She treats me as though I was a step child that she didn't particularly like but took care of out of duty to her husband. I know that this stems from the fact that she took it personally when I was a child, saying I didn't love mommy and I wanted grandma to be my real mommy. She never let my sister have a relationship with my grandmother, even!!
So, my advice is, of course, not to let these few months destroy the relationship between you and your child. Although it's been over 2 decades since my very strong grandma-preference, I'm still feeling the effects of it. Kids don't mean to be hurtful at that age; try not to take it all that personally.