Suppose that $S$ follows a geometric brownian motion
$$dS=S(\mu dt+\sigma dB).$$
It is well understood that
$$S_{T}=S_{0}exp((\mu-\dfrac{\sigma^{2}}{2})T+\sigma B_{T}).$$
Method 1 (I have no problem with this)
Letting $f(S)=log(S)$ and doing a 2nd order Taylor expansion and noting that $(dB)^{2}=dt$. For example:
$$d(log(S)) = f'(S)dS+\dfrac{1}{2}f''(S)S^{2}\sigma^{2}dt=\dfrac{1}{S}(\mu dt+\sigma SdB)-\dfrac{1}{2}\sigma^{2}dt=(\mu-\dfrac{\sigma^{2}}{2})dt+\sigma dB.\quad (*)$$
It follows that
$$log(S_{T})=log(S_{0})+(\mu-\dfrac{\sigma^{2}}{2})T+\sigma B_{T}$$ and hence
$$S_{T}=S_{0}exp((\mu-\dfrac{\sigma^{2}}{2})T+\sigma B_{T}).$$
The above derivation is perfectly fine and can be found on Wikipedia for example.
Method 2 (is this allowed?)
Let's use Ito's lemma
$$dF(t,X(t))=(F_{t}'+a(t)F_{x}'+\dfrac{1}{2}b(t)^{2}F''_{xx})dt+(b(t)F'_{x})dB $$ for a process $dX(t)=a(t)dt+b(t)dB(t)$ and for a function $F(t,X(t))$. Let $F(t,X(t))=log(X(t)).$ Let $dS=S\mu dt+S\sigma dB$, and let $a(t)=S\mu$ and $b(t)=S\sigma$. This is my question: $a(\cdot)$ is a function of $t$ and not $S$, so is this still OK to do?. Then
$$dF=(0+\mu+\dfrac{1}{2}\sigma^{2}S^{2}\times(\dfrac{-1}{S^{2}}))dt+\sigma\dfrac{S}{S}dB=(\mu-\dfrac{1}{2}\sigma^{2})dt+\sigma dB.$$ Here we arrive at (*) from Method 1 and hence the result follows.
Is this derivation technically correct? Just because it gives the right answer, it does not imply the method is sound.