When you apply the parallel axis theorem in the last line, you need to substitute $3m$ for mass in the second term of your equation, as $m + 2m$ is the total mass of your system. (Similarly, $\frac{1}{4}md^2$ is the total moment of inertia of the system about an axis through the rod's midpoint.)
After doing so, your equation evaluates to $\frac{1}{4}md^2 + \frac{1}{3}md^2 = \frac{7}{12}md^2$.
The force $m_1g\sin\theta$ provides the moment $Rm_1g\sin\theta$ ($R$ is the radius of the flywheel), so the equation of motion becomes:
$I\ddot\theta+Rm_1g\sin\theta=0$.
For small $\theta$, then $\sin\theta \approx \theta$, so we get:
$\large{\ddot\theta+\frac{Rm_1g}{I}\theta=0}$.
The solution of this classic DE is:
$\theta(t)=\theta_0 \cos(\sqrt{\frac{Rm_1g}{I}}t)$, with period $T$:
$T=2\pi\sqrt{\frac{I}{Rm_1g}}$, so that:
$\Large{I=\frac{Rm_1gT^2}{4\pi^2}}$.
I've seen a method for experimentally determining the moment of inertia of a flywheel and I'm not sure whats the reasoning behind it. You attach a small weight m1 to the flywheel's edge, it's important that m1≪M, M being the mass of the flywheel, so we can approximate that the small mass does not change the MOI of the flywheel.
The derivation above is for that case described in your question. But it doesn't correspond to the formula you gave.
For the formula you gave, the inertial moment of $m_1$ is actually taken into account as follows. The actual inertial moment, including that of $m_1$ is $I'$:
$I'=I+m_1R^2$.
All we have to do now is substitute $I$ with $I'$, so that:
$T=2\pi\sqrt{\frac{I+m_1R^2}{Rm_1g}}$, so that:
$\large{I+m_1R^2=\frac{Rm_1gT^2}{4\pi^2}}$
$\Large{I=\left( \frac{T^2 g}{4 \pi ^2R} - 1\right) m_1 R^2}$.
As in your formula, but only if you do allow for the effect of $m_1$ on the total moment of inertia.
Best Answer
Here are some slides I put together. They may not be completely rigorous but I believe they may help you understand a simplified derivation: