[proofplan]
The map $R \to \mathbb{T}_{\mathfrak{m}}$ is obtained from the universal property of the global deformation ring applied to the Galois representation valued in the localised Hecke algebra. Its surjectivity follows because Frobenius traces map to the Hecke operators $T_p$, and these operators topologically generate $\mathbb{T}_{\mathfrak{m}}$. Injectivity is proved after Taylor–Wiles patching: the kernel of the patched map annihilates the patched module, and faithfulness of that module over the patched deformation ring forces the kernel to vanish. The descent argument uses this patched injectivity, not patched surjectivity: after quotienting by the Taylor-Wiles augmentation ideal, any element in the kernel of $R \to \mathbb{T}_{\mathfrak{m}}$ lifts to an element of $R_{\infty}$ whose image lies in the image of the augmentation ideal, and patched injectivity forces that lift to lie in the augmentation ideal itself. This proves injectivity of the original map, and the earlier Frobenius-trace argument gives surjectivity.
[/proofplan]
[step:Construct the deformation-to-Hecke homomorphism from the universal property of $R$]
Let $\mathcal{C}_{\mathcal{O}}$ denote the category of complete Noetherian local $\mathcal{O}$-algebras with residue field $k$ and local $\mathcal{O}$-algebra homomorphisms inducing the identity on $k$. By hypothesis, the global deformation functor $\mathcal{D}: \mathcal{C}_{\mathcal{O}} \to \operatorname{Set}$ is represented by $R$. The oddness, modularity, and prescribed ordinary, finite-flat, minimal, and semistable local hypotheses are used here through the stated representability of this deformation problem and through the existence of the matching Hecke-side Galois representation satisfying the same local conditions.
The representation
\begin{align*}
\rho_{\mathbb{T}}:G_{\mathbb{Q}}\to GL_2(\mathbb{T}_{\mathfrak{m}})
\end{align*}
is a lift of $\bar{\rho}$ with determinant $\delta$, is unramified outside $S$, and satisfies the local condition $\mathcal{D}_v$ at every $v \in S$. Hence $\rho_{\mathbb{T}}$ defines an element of $\mathcal{D}(\mathbb{T}_{\mathfrak{m}})$. Since $R$ represents $\mathcal{D}$, this element corresponds to a unique local $\mathcal{O}$-algebra homomorphism
\begin{align*}
\varphi:R\to \mathbb{T}_{\mathfrak{m}}.
\end{align*}
This is the natural deformation-to-Hecke homomorphism.
[guided]
The deformation ring $R$ is universal for the deformation problem. This means that to give a local $\mathcal{O}$-algebra homomorphism from $R$ to any complete local $\mathcal{O}$-algebra $A$ is the same thing as giving a deformation of $\bar{\rho}$ to $A$ satisfying the fixed determinant and all imposed local conditions.
We apply this with $A=\mathbb{T}_{\mathfrak{m}}$. The hypothesis gives a continuous representation
\begin{align*}
\rho_{\mathbb{T}}:G_{\mathbb{Q}}\to GL_2(\mathbb{T}_{\mathfrak{m}})
\end{align*}
which reduces to $\bar{\rho}$ modulo the maximal ideal of $\mathbb{T}_{\mathfrak{m}}$, has determinant $\delta$, is unramified outside $S$, and satisfies the prescribed local deformation condition at every prime in $S$. Thus $\rho_{\mathbb{T}}$ is exactly an element of the deformation functor value $\mathcal{D}(\mathbb{T}_{\mathfrak{m}})$.
Because $R$ represents $\mathcal{D}$, this element determines a unique local $\mathcal{O}$-algebra homomorphism
\begin{align*}
\varphi:R\to \mathbb{T}_{\mathfrak{m}}.
\end{align*}
This is the map whose bijectivity we must prove.
[/guided]
[/step]
[step:Prove that the map $R \to \mathbb{T}_{\mathfrak{m}}$ is surjective from Frobenius traces]
For every prime $p \notin S$ at which $T_p$ is defined, compatibility of $\rho_{\mathbb{T}}$ with the Hecke action gives
\begin{align*}
\varphi\bigl(\operatorname{tr}(\rho_R(\operatorname{Frob}_p))\bigr)
=
\operatorname{tr}\bigl(\rho_{\mathbb{T}}(\operatorname{Frob}_p)\bigr)
=
T_p,
\end{align*}
where
\begin{align*}
\rho_R:G_{\mathbb{Q}}\to GL_2(R)
\end{align*}
denotes the universal deformation. The first equality is the functoriality of the universal representation under base change along $\varphi$: the representation obtained from $\rho_R$ by applying $\varphi$ to its matrix coefficients is $\rho_{\mathbb{T}}$, and trace commutes with applying a ring homomorphism entrywise. By hypothesis, $\mathbb{T}_{\mathfrak{m}}$ is topologically generated as an $\mathcal{O}$-algebra by these operators $T_p$. Therefore the image of $\varphi$ is a closed $\mathcal{O}$-subalgebra of $\mathbb{T}_{\mathfrak{m}}$ containing a set of topological generators, so
\begin{align*}
\operatorname{im}(\varphi)=\mathbb{T}_{\mathfrak{m}}.
\end{align*}
Thus $\varphi$ is surjective.
[guided]
The Hecke algebra is generated by the Hecke operators $T_p$, so to prove surjectivity it is enough to show that each such $T_p$ lies in the image of $\varphi$.
Let
\begin{align*}
\rho_R:G_{\mathbb{Q}}\to GL_2(R)
\end{align*}
be the universal deformation. Applying $\varphi$ to its coefficients gives the deformation $\rho_{\mathbb{T}}$. More explicitly, base change of $\rho_R$ along $\varphi$ means that each matrix coefficient of $\rho_R(g)$ is sent by $\varphi$ to the corresponding matrix coefficient of $\rho_{\mathbb{T}}(g)$ for every $g \in G_{\mathbb{Q}}$. Since the trace of a $2 \times 2$ matrix is the sum of its two diagonal entries, trace commutes with this entrywise application of $\varphi$. Hence, for every prime $p \notin S$ where $T_p$ is defined, the trace is compatible with $\varphi$:
\begin{align*}
\varphi\bigl(\operatorname{tr}(\rho_R(\operatorname{Frob}_p))\bigr)
=
\operatorname{tr}\bigl(\rho_{\mathbb{T}}(\operatorname{Frob}_p)\bigr).
\end{align*}
The defining Galois-Hecke compatibility of $\rho_{\mathbb{T}}$ identifies the right-hand side with $T_p$, so
\begin{align*}
\varphi\bigl(\operatorname{tr}(\rho_R(\operatorname{Frob}_p))\bigr)=T_p.
\end{align*}
Thus every topological generator $T_p$ of $\mathbb{T}_{\mathfrak{m}}$ lies in the image of $\varphi$. Since $\varphi$ is a continuous map between complete local $\mathcal{O}$-algebras, its image is the complete local $\mathcal{O}$-subalgebra generated by the images of elements of $R$. Therefore containing the topological generators forces
\begin{align*}
\operatorname{im}(\varphi)=\mathbb{T}_{\mathfrak{m}}.
\end{align*}
[/guided]
[/step]
[step:Use patched faithfulness to show that the patched homomorphism has zero kernel]
Let
\begin{align*}
\varphi_{\infty}:R_{\infty}\to \mathbb{T}_{\infty}
\end{align*}
be the patched deformation-to-Hecke homomorphism produced by the Taylor-Wiles construction, and let $M_{\infty}$ be the patched Hecke module. By hypothesis, the action of $R_{\infty}$ on $M_{\infty}$ factors through $\mathbb{T}_{\infty}$ via $\varphi_{\infty}$. Hence every element of $\ker(\varphi_{\infty})$ acts as zero on $M_{\infty}$.
Let
\begin{align*}
\operatorname{Ann}_{R_{\infty}}(M_{\infty})
=
\{r\in R_{\infty}: r m=0 \text{ for every } m\in M_{\infty}\}
\end{align*}
be the annihilator ideal of $M_{\infty}$ as an $R_{\infty}$-module. The preceding paragraph gives
\begin{align*}
\ker(\varphi_{\infty})\subseteq \operatorname{Ann}_{R_{\infty}}(M_{\infty}).
\end{align*}
Since $M_{\infty}$ is faithful as an $R_{\infty}$-module, its annihilator is zero:
\begin{align*}
\operatorname{Ann}_{R_{\infty}}(M_{\infty})=(0).
\end{align*}
Therefore
\begin{align*}
\ker(\varphi_{\infty})=(0).
\end{align*}
Thus $\varphi_{\infty}$ is injective.
[guided]
The patched module is the place where the numerical Taylor-Wiles argument enters. The important formal consequence assumed here is faithfulness: an element of $R_{\infty}$ is zero if it acts as zero on $M_{\infty}$.
We use the factorisation of the action. The $R_{\infty}$-module structure on $M_{\infty}$ is obtained by first mapping
\begin{align*}
R_{\infty}\xrightarrow{\varphi_{\infty}}\mathbb{T}_{\infty}
\end{align*}
and then using the Hecke action of $\mathbb{T}_{\infty}$ on $M_{\infty}$. Therefore if $r\in \ker(\varphi_{\infty})$, then $\varphi_{\infty}(r)=0$ in $\mathbb{T}_{\infty}$, so $r$ acts as the zero operator on $M_{\infty}$.
Equivalently,
\begin{align*}
\ker(\varphi_{\infty})
\subseteq
\operatorname{Ann}_{R_{\infty}}(M_{\infty}),
\end{align*}
where
\begin{align*}
\operatorname{Ann}_{R_{\infty}}(M_{\infty})
=
\{r\in R_{\infty}: r m=0 \text{ for every } m\in M_{\infty}\}.
\end{align*}
Faithfulness of $M_{\infty}$ as an $R_{\infty}$-module says exactly that this annihilator is the zero ideal. Hence every element of $\ker(\varphi_{\infty})$ is zero, and so
\begin{align*}
\ker(\varphi_{\infty})=(0).
\end{align*}
Thus the patched map $\varphi_{\infty}$ is injective.
[/guided]
[/step]
[step:Record the patched injectivity needed for descent]
The previous step proves
\begin{align*}
\ker(\varphi_{\infty})=(0).
\end{align*}
Thus the patched homomorphism
\begin{align*}
\varphi_{\infty}:R_{\infty}\to \mathbb{T}_{\infty}
\end{align*}
is injective. No surjectivity of $\varphi_{\infty}$ is required for the descent argument below; the quotient argument will use only this injectivity and the compatibility of the augmentation ideals.
[/step]
[step:Descend patched injectivity to the original deformation and Hecke algebras]
Let $\mathfrak{a}_{\infty}\subset R_{\infty}$ be the Taylor-Wiles augmentation ideal, and define its image ideal in the patched Hecke algebra by
\begin{align*}
\mathfrak{b}_{\infty}:=\varphi_{\infty}(\mathfrak{a}_{\infty})\subset \mathbb{T}_{\infty}.
\end{align*}
By the patched descent hypothesis, there are compatible identifications
\begin{align*}
R_{\infty}/\mathfrak{a}_{\infty} &\cong R,\\
\mathbb{T}_{\infty}/\mathfrak{b}_{\infty} &\cong \mathbb{T}_{\mathfrak{m}},
\end{align*}
and the quotient map induced by $\varphi_{\infty}$ is precisely the original homomorphism
\begin{align*}
\varphi:R\to \mathbb{T}_{\mathfrak{m}}.
\end{align*}
We prove this quotient map is injective. Let $\bar{r}\in R_{\infty}/\mathfrak{a}_{\infty}$ be an element whose image in $\mathbb{T}_{\infty}/\mathfrak{b}_{\infty}$ is zero, and choose a lift $r\in R_{\infty}$ of $\bar{r}$. The vanishing of the quotient image means
\begin{align*}
\varphi_{\infty}(r)\in \mathfrak{b}_{\infty}=\varphi_{\infty}(\mathfrak{a}_{\infty}).
\end{align*}
Hence there exists $a\in \mathfrak{a}_{\infty}$ such that
\begin{align*}
\varphi_{\infty}(r)=\varphi_{\infty}(a).
\end{align*}
Subtracting in the complete local $\mathcal{O}$-algebra $\mathbb{T}_{\infty}$ gives
\begin{align*}
\varphi_{\infty}(r-a)=0.
\end{align*}
Since the previous step proved $\ker(\varphi_{\infty})=(0)$, we obtain $r-a=0$, so $r=a\in \mathfrak{a}_{\infty}$. Therefore $\bar{r}=0$ in $R_{\infty}/\mathfrak{a}_{\infty}$, and the quotient map is injective.
Under the descent identifications, this proves that the original homomorphism $\varphi:R\to \mathbb{T}_{\mathfrak{m}}$ is injective. The Frobenius-trace argument above already proved that $\varphi$ is surjective. Therefore $\varphi$ is an isomorphism of complete local $\mathcal{O}$-algebras.
[/step]