In order for the patching to work as expected, you need to understand how the function you're patching is constructed. Here is \@part as it's defined in scrreprt.cls:
\def\@part[#1]#2{%
\ifnum \scr@osectarg=\z@
\@scr@tempswafalse
\else
\scr@istest#1=\@nil
\fi
\if@scr@tempswa
\setkeys{KOMAarg.section}{tocentry={#2},head={#2},#1}%
\else
\ifcase \scr@osectarg\relax
\setkeys{KOMAarg.section}{tocentry={#1},head={#1}}%
\or
\setkeys{KOMAarg.section}{tocentry={#2},head={#1}}%
\or
\setkeys{KOMAarg.section}{tocentry={#1},head={#2}}%
\or
\setkeys{KOMAarg.section}{tocentry={#1},head={#1}}%
\fi
\fi
\ifnumbered{part}{%
\refstepcounter{part}%
\@maybeautodot\thepart%
\ifx\scr@ds@tocentry\@empty\else
\addparttocentry{\thepart}{\scr@ds@tocentry}%
\fi
}{%
\ifx\scr@ds@tocentry\@empty\else
\addparttocentry{}{\scr@ds@tocentry}%
\fi
}%
\begingroup
\setparsizes{\z@}{\z@}{\z@\@plus 1fil}\par@updaterelative
\raggedpart
\interlinepenalty \@M
\normalfont\sectfont\nobreak
\ifnumbered{part}{%
\size@partnumber{\partformat}%
\partheadmidvskip
}{}%
\size@part{#2}\strut
\ifx\partmark\@gobble
\@mkboth{}{}\par
\else
\expandafter\partmark\expandafter{\scr@ds@head}\par
\fi
\endgroup
\@endpart
}
It seems best to insert new ToC-related entries at the point where \@part issues \begingroup. For this we only need etoolbox to patch in the following way:
\usepackage{etoolbox}
\makeatletter
% \pdfstrcmp{<string1>}{<string2>}
% \pdfstrcmp compares two strings and expands to 0 if the strings are equal, to -1 if the first string
% ranks before the second, and to 1 otherwise
\patchcmd{\@part}% <cmd>
{\begingroup}% <search>
{\ifnum\pdfstrcmp{#1}{#2}=0
\addcontentsline{toc}{chapter}{\protect\textcolor{blue}{#2}}%
\else
\addcontentsline{toc}{chapter}{\protect\textcolor{red}{#1}}%
\fi%
\begingroup}%
{}{}%
\makeatother
The above inserts two \addcontentsline macros immediately before \begingroup. They are conditional on whether #1 matches #2 or not (using e-TeX's \pdfstrcmp). If they're the same, it means the user didn't supply an optional argument.
Note how content written to the ToC is \protected in order to avoid expansion. This is typical when writing to files to ensure things don't go horribly wrong.
Here is a complete minimal example:

\documentclass{scrreprt}
\usepackage{etoolbox,xcolor}
\makeatletter
% \pdfstrcmp{<string1>}{<string2>}
% \pdfstrcmp compares two strings and expands to 0 if the strings are equal, to -1 if the first string
% ranks before the second, and to 1 otherwise
\patchcmd{\@part}% <cmd>
{\begingroup}% <search>
{\ifnum\pdfstrcmp{#1}{#2}=0
\addcontentsline{toc}{chapter}{\protect\textcolor{blue}{#2}}%
\else
\addcontentsline{toc}{chapter}{\protect\textcolor{red}{#1}}%
\fi%
\begingroup}%
{}{}%
\makeatother
\begin{document}
\tableofcontents
\part{Only Long Caption}
\part[Short Caption]{Long Caption}
\end{document}
If you want the above to work with hyperref, you need to patch \H@old@part instead of \@part.
#1at the end of\@partand execute\addcontentsline...if the patch succeeds”. I guess you want\xpatchcmdinstead. – egreg Nov 13 '14 at 22:41\xpatchcmd{\@part}{##1}{\addcontentsline{toc}{chapter}{\textcolor{red}{##1}}}{}, but clearly I am not quite understanding it – Jörg Nov 13 '14 at 22:41\def(and\edefis\defunder cover). – egreg Nov 13 '14 at 22:54\def; once their job has ended, it's like a suitable\defhad been executed. In other words, once\newcommand{\foo}{bar}has been issued, as far as TeX is concerned you could as well have used\long\def\foo{bar}. – egreg Nov 13 '14 at 22:59