You claim that
According to the principle of relativity the light will not strike the detector in the reference frame of a non-moving observer
If the detector is on the floor of the train, then this is false. Both the observer on the train, and the observer outside of the train (who is stationary with respect to the Earth let's say), will see the light strike the detector. The person outside of the train will simply see the light travel along a "diagonal" path as illustrated in the image below. The left-hand image is what the train observer sees, and the right-hand imagine is what someone on the outside of the train sees.

The Math.
In the train, which we call frame $S'$, the spacetime trajectory of the light between when it leaves the ceiling at parameter value $\lambda = 0$ and when it hits the detector on the floor at parameter value $\lambda = d/c$ is given by is given by the following parameterized curve
\begin{align}
t'(\lambda) = \lambda, \qquad x'(\lambda) = 0, \qquad y'(\lambda) = d-c\lambda
\end{align}
where I have taken the $y'$-axis perpendicular to the floor, the $x'$-axis parallel to the direction of motion of the train, and we ignore motion in $z'$. Notice that since $t'(\lambda) = \lambda$ the parameter $\lambda$ here is really just time according to a train observer. To determine what the person outside of the train, which we call frame $S$ sees, we apply the Lorentz transformation:
\begin{align}
\begin{pmatrix}
ct(\lambda) \\
x(\lambda) \\
y(\lambda) \\
\end{pmatrix}
&= \begin{pmatrix}
\gamma & \gamma\beta & 0 \\
\gamma\beta & \gamma & 0 \\
0 & 0 & 1 \\
\end{pmatrix}
\begin{pmatrix}
ct'(\lambda) \\
x'(\lambda) \\
y'(\lambda) \\
\end{pmatrix}
= \begin{pmatrix}
c\gamma\lambda \\
c\gamma\beta\lambda \\
d-c\lambda \\
\end{pmatrix}
\end{align}
where we have assumed that the train moves along the positive $x$-axis with speed $v = \beta c$. In other words, the path of the light in the frame $S$ is
\begin{align}
t(\lambda) = \gamma\lambda, \qquad x(\lambda) = \gamma \beta c\lambda, \qquad x(\lambda) = d-c\lambda
\end{align}
For convenience, we reparameterize this curve by defining $\mu = \gamma\lambda$ to give
\begin{align}
t(\mu) = \mu, \qquad x(\mu) = v\mu, \qquad y(\mu) = d- c\mu/\gamma
\end{align}
where we used $\beta c = v$ to simplify the $x$ component. The parameter $\mu$ is just the time as measured by an $S$ observer since $t(\mu) = \mu$. Notice, that the $x$-component of the trajectory now is nonzero, and in fact the light has velocity $v$ in the same direction as the train!
As a final check, let's make sure that the speed of the light is $c$ in both frames. In the train frame we have
\begin{align}
v'_\mathrm{light} = \sqrt{\frac{dx'}{d\lambda}^2 + \frac{dy'}{d\lambda}^2} = \sqrt{0+c^2} = c
\end{align}
and in the frame outside the train we have
\begin{align}
v_\mathrm{light}
&= \sqrt{\frac{dx}{d\mu}^2 + \frac{dy}{d\mu}^2} = \sqrt{v^2 + \frac{c^2}{\gamma^2}}
= c\sqrt{\beta^2+\frac{1}{\gamma^2}} = c\sqrt{\beta^2 +1-\beta^2}=c
\end{align}