Extract correct counter value of a reference

Maybe I'm missing an important complication, but I think all you need to do is (a) define a "scratch" counter variable named, say, scratchcounter, in the preamble and (b) use an instruction such as

\setcounter{scratchcounter}{\value{theorem}}

immediately after the theorem in question to store the number of the theorem (minus the "prefix") in the counter named scratchcounter. Its value may be accessed elsewhere in the document via \thescratchcounter.

enter image description here

\documentclass{article}
\usepackage{amsthm} % or: "\usepackage{ntheorem}"
\newtheorem{theorem}{Theorem}[section]

\newcounter{scratchcounter} % define the scratch counter

\begin{document}
\setcounter{section}{2}   % just for this example
\setcounter{theorem}{20}

\begin{theorem}[Pythagoras] \label{thm:pyth}
$a^2+b^2=c^2$.
\end{theorem}
\setcounter{scratchcounter}{\value{theorem}} % Store value of 'theorem' counter

\bigskip\noindent
Later on \dots\ the value of the ``scratch'' counter is \thescratchcounter.
\end{document}

The following solution implements \extractthmnum{<cnt>}{<ref>} in a similar way to refcount's \setcounterref:

enter image description here

\documentclass{article}

\newtheorem{theorem}{Theorem}[section]
\newcounter{mycount}

\makeatletter
\def\@extractthmnum#1.#2{#2}
\newcommand{\extractthmnum}[2]{% \extractthmnum{<cnt>}{<ref>}
  \setcounter{#1}{0}% Default
  \ifcsname r@#2\endcsname
    \edef\@tempa{\csname r@#2\endcsname}% Extract complete reference
    \edef\@tempa{\expandafter\@firstoftwo\@tempa}% Extract number
    \setcounter{#1}{\expandafter\@extractthmnum\@tempa}% Strip number
  \fi
}
\makeatother

\begin{document}

\setcounter{section}{1}
\section{A section}

\setcounter{theorem}{20}
\begin{theorem}\label{thm:theorem}
A theorem.
\end{theorem}

See Theorem~\ref{thm:theorem}.

\extractthmnum{mycount}{thm:theorem}%
See Theorem~\themycount.

‎\end{document}‎

The idea of \StrBehind is good, but you have to use it in a different way.

\StrBehind{\getrefnumber{orbitcomeagre}}{.}[\orbitcomeagrenumber]
\setcounter{theorem}{0\orbitcomeagrenumber}

The 0 is for avoiding issues when the reference is not yet defined and \StrBehind would output nothing.

\documentclass{article}

\usepackage{xstring,refcount}

\newtheorem{theorem}{Theorem}[section]
\newcounter{mycount}

\begin{document}

\setcounter{section}{1}
\section{A section}

\setcounter{theorem}{20}

\begin{theorem}\label{orbitcomeagre}
A theorem.
\end{theorem}

See Theorem~\ref{orbitcomeagre}.

\StrBehind{\getrefnumber{orbitcomeagre}}{.}[\orbitcomeagrenumber]
\setcounter{mycount}{0\orbitcomeagrenumber}

See Theorem~\themycount.

\end{document} 

enter image description here

An “abstract” version:

\documentclass{article}

\usepackage{xstring,refcount}

\newtheorem{theorem}{Theorem}[section]

\newcounter{mycount}

\newcommand{\setcountertoref}[2]{%
  \begingroup
  \StrBehind{\getrefnumber{#2}}{.}[\setcountertoreftemp]%
  \setcounter{#1}{0\setcountertoreftemp}%
  \endgroup
}

\begin{document}

\setcounter{section}{1}
\section{A section}

\setcounter{theorem}{20}

\begin{theorem}\label{orbitcomeagre}
A theorem.
\end{theorem}

See Theorem~\ref{orbitcomeagre}.

\setcountertoref{mycount}{orbitcomeagre}

See Theorem~\themycount.

\end{document}‎