The density of the multivariate Gaussian (=normal) distribution is given by $$ f(\mathbf{x},\boldsymbol{\mu},\Sigma)=\frac{1}{(2\pi)^{\frac{d}{2}} \left|\Sigma\right|^{\frac{1}{2}}}e^{-\frac{1}{2}(\mathbf{x}-\boldsymbol{\mu})^T\Sigma^{-1}(\mathbf{x}-\boldsymbol{\mu})} $$
Suppose we integrate $f$ with respect to vector $\mathbf{x}$ over some subset $\mathcal{S}\subseteq \mathbb{R}^d$, i.e., $v=\int_{\mathcal{S}} f(\mathbf{x},\boldsymbol{\mu},\Sigma)d\mathbf{}$. Note that $\mathcal{S}$ is not a function of $\boldsymbol{\mu}$ or $\Sigma$ (or $\mathbf{x}$). According to my knowledge, the quantity $v$ should be a scalar.
Further suppose we want to know how $v$ changes with respect to mean vector $\boldsymbol{\mu}.$ If we take the gradient $$ w_1=\nabla v=\frac{\partial}{\partial\boldsymbol{\mu}}v=\frac{\partial}{\partial\boldsymbol{\mu}}\int_{\mathcal{S}} f(\mathbf{x},\boldsymbol{\mu},\Sigma)d\mathbf{x} $$ we should get a vector for $w_1$ because we are deriving a scalar by a vector. The Leibniz rule of integration says that
$$ \frac{\partial}{\partial\boldsymbol{\mu}}\int_{\mathcal{S}} f(\mathbf{x},\boldsymbol{\mu},\Sigma)d\mathbf{x} =\int_{\mathcal{S}} \frac{\partial}{\partial\boldsymbol{\mu}}f(\mathbf{x},\boldsymbol{\mu},\Sigma)d\mathbf{x} $$
Now suppose $\mathcal{S}=\mathbb{R}^d$. Then, using simple calculus, we would get
$$ \int_{\mathbb{R}^d} \frac{\partial}{\partial\boldsymbol{\mu}}f(\mathbf{x},\boldsymbol{\mu},\Sigma)d\mathbf{x} = -\int_{\mathbb{R}^d} \frac{\partial}{\partial\mathbf{x}}f(\mathbf{x},\boldsymbol{\mu},\Sigma)d\mathbf{x} = w_2 $$ because $\frac{\partial}{\partial\boldsymbol{\mu}}f(\mathbf{x},\boldsymbol{\mu},\Sigma)d\mathbf{x} = - \frac{\partial}{\partial\mathbf{x}}f(\mathbf{x},\boldsymbol{\mu},\Sigma)d\mathbf{x}$. According to my understanding $w_2$ should be a scalar, because of the fundamental theorem of calculus. But this makes no sense because, as highlighted above, it would seem that $w_1=w_2$, i.e., a vector is equal to a scalar?! So I must have broken a rule somewhere, or misunderstood how the mentioned theorems worked. Where did I go wrong?