In a group $G$ where $\exists!$ nontrivial, proper subgroup, show that $G$ is cyclic and $\lvert G\rvert=p^2$, for $p$ prime.
Claim:$G$ is cyclic.
Proof: If not, then there must be two distinct elements $a$ and $b$ that generate two distinct cyclic subgroups. Thus, $G$ must be cyclic.
From here, we know all cyclic groups are isomorphic to $\mathbb{Z}_n$, where $n = |G|$. At this point, we are done: For all cyclic groups $H$, there will exist exactly $1$ cyclic subgroup for each divisor of $|H|$. Thus, $|G| = p^2$
The idea is to first show that $G$ is cyclic and then use this fact to deduce that $|G|=p^2$ where $p$ is prime.
To show that $G$ is cyclic let $G$ be a group with exactly one non trivial subgroup. Then $G$ contains at least two (different) non trivial elements $a,b \in G $. Certainly, $\langle a \rangle $ is a non trivial subgroup of $G$. If $\langle a \rangle = G$ we're done since $G$ is cyclic.
Otherwise note that we must have $\langle a \rangle = \langle b \rangle$ since there is only one non trivial subgroup. Let $c$ be any element in $G \setminus \langle a \rangle $. Then $\langle c \rangle = G$ since we cannot have $\langle c \rangle = \langle a \rangle$. Hence $G$ is cyclic.
A cyclic group has a subgroup for every divisor of the order of the group. Hence we can only have one divisor of $|G|$, that is, $|G| = p^2$ or $|G| = p$ but the latter is not possible since there is one proper subgroup.
You're on the right track - your idea of considering orders of members of the group is good. A slightly more general idea that resolves this is to, rather than the orders, consider, for any element $x\in G$, the subgroup generated by $x$, namely $\{1,x,x^2,\ldots\}$.
For any non-identity element, this subgroup is non-trivial. There are two non-trivial subgroups of $G$ - being $G$ itself and a proper subgroup which we'll call $G'$. Now, if we choose some element $x$ of $G$ which is not in $G'$, then it follows that the subgroup generated by $x$ must not be a subset of $G'$ - and the only subgroup which isn't is $G$ itself. This establishes that such an $x$ generates the whole group - meaning the group is cyclic.
Given that you've already proven that $x$ would have order $p^n$ for some $n$, you just need to prove that if it has order $p$, then it has no non-trivial proper subgroups and if it has order $p^n$ for $n>2$, then the subgroups generated by $x^p$ and $x^{p^2}$ are distinct non-trivial proper subgroups. This leaves that $x$ has order $p^2$ and generates the group has order $p^2$ and is cyclic.